Output top level nodes in Umbraco Razor navigation -
I am struggling with a very simple Umbraco 7 navigation. In fact, I have several "sites" in one solution - or, one site, but their home page for different countries and languages are top-level nodes, and all sub-pages are nested in level 2 and below.
It works fine for individual sites (output of children in level 1 node). However, I want to create a second menu which outputs only the top-level nodes, where I can switch between different sites. This, for some reason, I can not.
@ Inherits umbraco themepage @ {var homepage = current page Ancestors Orsulf (1). first (); Var subitems = homepage children; Var rootItems = homePage.Siblings; } & Lt; Ul & gt; @Forrench (various items in sub-item) {& lt; Li & gt; @ Item.Name & lt; / Li & gt; } & Lt; / Ul & gt; & Lt; Ul & gt; @forchange (item in root items) {& lt; Li & gt; @ImageName & Lt; / Li & gt; } & Lt; / Ul & gt;
This first list displays completely, but there is no output in the second list if I try the output @ homePage.Name
Returns an output, so I know that the root objects are accessible.
Ideally, I want to output it to all root nodes in the second navigation (basically SiblinbsOrSelf ()
).
What am I doing wrong?
To get all the nodes at the root level:
var RootNodes = Umbraco.TypedContentAtRoot ();
This will include the existing page, which can be left if necessary.
To do this essentially to output to ul
:
& lt; Ul & gt; @ Urach (root nodes in root n) {& lt; Li & gt; @ N. Name & lt; / Li & gt; } & Lt; / Ul & gt;
Comments
Post a Comment