Copied to clipboard

Flag this post as spam?

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


  • Jon 92 posts 166 karma points
    Feb 05, 2021 @ 15:58
    Jon
    0

    Umbraco 8 Render a Page's HTML

    Hi,

    I am using Funnelback to index our content - they require that we send them a Page's HTML markup each time we Publish a page.

    There is this method - RenderTemplate(ID) - but it is said not to use this. Plus I cant see a way to render a different language.

    Is there a safe way to render the pages markup plus to render it with the current language (Culture).

    I doing this call within the PublishEventsComponent -

     private void ContentService_Publishing(IContentService sender, ContentPublishingEventArgs e)
    

    Thanks

  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    Feb 06, 2021 @ 22:27
    Søren Kottal
    0

    Hi Jon

    RenderTemplate is the only way to do it using out of the box Umbraco.

    Or you could scrape the html using a http request.

    In your original post (https://our.umbraco.com/forum/using-umbraco-and-getting-started/104871-umbraco-8-get-page-html-in-code) I've linked to how I use RenderTemplate (including setting which culture to render) in my Full Text Search package.

    The package does pretty much the same when indexing, like you want to do for sending content to Funnelback. So take a look at the source code, and see if it can inspire you for your project.

Please Sign in or register to post replies

Write your reply to:

Draft