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?
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.
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?
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
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
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.
Hi Guys,
The rendertemplate method does exactly what I'm after, thanks for your help guys!
:)
is working on a reply...