I have found quite some very cool implementations how to use Razor to create navigation. My understanding is that I need to use @Model.AncestorOrSelf() or var items = node.Children.Where("Visible").Where("Level <= maxLevelForSitemap", values); to obtain list of nodes at each level. The sample I used is http://our.umbraco.org/forum/developers/razor/21519-Razor-code-for-complete-navigation
I usually have this razor script in my template (master) page to be used by all content pages.
But my question is that how can I get current page from the node tree? For example I need to have some special effects (e.g. bolder text or different background color) on current selected page's navigation item inside a tree. I checked umbraco.MacroEngine.dll and I could not find a property or function to get Self.All I see is AncestorOrSelf() or DescendantsOrSelf(), do I have to find overlapped items from these 2 lists to get Self?
How to get current page inside the node tree
Hi all,
I have found quite some very cool implementations how to use Razor to create navigation. My understanding is that I need to use @Model.AncestorOrSelf() or var items = node.Children.Where("Visible").Where("Level <= maxLevelForSitemap", values); to obtain list of nodes at each level. The sample I used is http://our.umbraco.org/forum/developers/razor/21519-Razor-code-for-complete-navigation
I usually have this razor script in my template (master) page to be used by all content pages.
But my question is that how can I get current page from the node tree? For example I need to have some special effects (e.g. bolder text or different background color) on current selected page's navigation item inside a tree. I checked umbraco.MacroEngine.dll and I could not find a property or function to get Self.All I see is AncestorOrSelf() or DescendantsOrSelf(), do I have to find overlapped items from these 2 lists to get Self?
Thanks
Hardy
How about:
Great, thanks!
is working on a reply...