Copied to clipboard

Flag this post as spam?

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


  • Chris 8 posts 77 karma points
    Aug 20, 2014 @ 16:18
    Chris
    0

    XSLT navigation macro not rendering on category and tag item pages

    On pages like /blog/categories/TestCategory my XSLT navigation macro isn't rending.

    For testing I've replaced my custom XSLT macro with the standard Navigation Prototype snippet and this too isn't rendering.

    I'm calling the macro from the master.cshtml view with the following line of code:

    @Html.Raw(@umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"StandardNav\" ></?UMBRACO_MACRO>", 1156))
    

    The last parameter "1156" is the node id of the /blog node.

    Is the best approach to be taking? I would like to keep using my custom XSLT macro and I'm keen to replace the hard coded node id.

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 20, 2014 @ 18:34
    Shannon Deminick
    0

    Hi, first umbraco.library is legacy and shouldn't really be used, also that syntax is super old.

    If you want to render a macro, use:

     @Umbraco.RenderMacro("StandardNav")
    

    In your macro you can get the 'blog' node by moving to it from the current descendant.

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 20, 2014 @ 18:35
    Shannon Deminick
    0

    But actually, in Articulate there are many 'virtual' nodes such as the ones you are referring to. There is no 'node' for them in the tree, and therefore there is no XML for these nodes.

  • Chris 8 posts 77 karma points
    Aug 21, 2014 @ 00:39
    Chris
    0

    Hi Shannon

    Originally I did try the @Umbraco.RenderMacro but it seems the method is not in scope in the Master.cshtml view, I would be more than happy to move to this newer syntax because the hard coded node id is painful at deployment.

    You comment on 'virtual' nodes explains why my macro isn't rending.

    I still would like to be able to display a navigation menu on these 'virtual' nodes, do you have any suggestion on an approach I might take.

Please Sign in or register to post replies

Write your reply to:

Draft