Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 17, 2010 @ 16:49
    Tim
    0

    Get rendered HTML from an Umbraco document

    I'm looking to convert some SEO tools that I've written to work natively in the back end of Umbraco. A lot of the tools take the HTML source of a page and rip it apart looking for various things with regex's etc.

    I can get the source by scraping the page from the front end, but that's not ideal, as every time you run the tool, you're generating a false hit on your site tracking.

    Is there a method in umbraco API that would allow me to return the fully rendered page HTML source of a page within the cms?

  • dandrayne 1138 posts 2262 karma points
    Feb 17, 2010 @ 17:47
    dandrayne
    1

    Someone else will be able to help you more than I with API matters, but this may be a start.

    http://umbraco.org/apiDocs/html/Overload_umbraco_library_RenderTemplate.htm

    Cheers,
    Dan

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 17, 2010 @ 18:16
    Dirk De Grave
    0

    As Dan points out, RenderTemplate() *can* be your friend, but only if you're running this from within the umbraco context, ie, running this code from your umbraco website instance. If this is not the case, use HttpWebRequest to "scrape" the content of any umbraco page and feed that to the other tools.

     

    Hope this helps.

    Regards,

    /Dirk

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 18, 2010 @ 12:06
    Tim
    0

    Hi DIrk,

    Thanks for the info! Do you mean from within the front end of the website, or can the function be called from the back end?

    Regards,

    Tim.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 18, 2010 @ 12:10
    Tim
    0

    Hi Guys,

    The rendertemplate method does exactly what I'm after, thanks for your help guys!

    :)

Please Sign in or register to post replies

Write your reply to:

Draft