Copied to clipboard

Flag this post as spam?

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


  • Shane 40 posts 193 karma points
    Mar 04, 2015 @ 21:30
    Shane
    0

    Macros not rendering

    I've followed Sebastiaan's post here for creating a blog archive:

    http://umbraco.com/follow-us/blog-archive/2014/1/27/a-practical-example-of-route-hijacking-in-umbraco

    The problem I'm having is that none of the macros are rendering on the blogroll. Macros are inserted using the richtext editor which contains text and macro content. If I view the page source it shows the unrendered "UMBRACO_MACRO" code block as it does in the HTML view of the editor.

    Anyone have any ideas how I can get these macros to run?

    Thanks

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Mar 04, 2015 @ 22:02
    Jan Skovgaard
    0

    Hi Shane

    What exact version of Umbraco 7 are you using? And what does your Razor code for rendering your blogposts look like? Inside the foreach statement I'm thinking?

    /Jan

  • Shane 40 posts 193 karma points
    Mar 04, 2015 @ 22:56
    Shane
    0

    Hi Jan,

    I'm using version 7.2.1. I'm using a foreach statement as in the blog post. A simplified version is:

    @foreach (var post in Model.BlogPosts)
    {   
        @post.GetProperty("pageText").Value
    } 
    

    Thanks

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Mar 05, 2015 @ 05:27
    Jan Skovgaard
    100

    Hi Shane

    Ok, not sure but think you might be able to do this @Html.Raw(umbraco.library.RenderMacroContent(@post.GetProperty("pageText").Value, @post.GetProperty("pageText").Id))

    Try having a look at this post https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/48747-Rendering-Macros-From-Macro-Container-MVC

    Hope this helps.

    /Jan

  • Shane 40 posts 193 karma points
    Mar 05, 2015 @ 19:48
    Shane
    0

    You're a lifesaver. Thanks Jan!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies