ps-team
10/27/2017 - 8:11 AM

A simple navigation that outputs the contents of the current folder and the homepage of any sub folders one level below.

A simple navigation that outputs the contents of the current folder and the homepage of any sub folders one level below.

@using Contensis.Framework.Web

<ul class="secondaryNav">
  
  	<li class="secondaryNav__title"><a href="@CurrentNode.Parent.Parent.Path">@CurrentNode.Parent.Title</a></li>
  
    @foreach (ContentNode navItem in CurrentNode.Parent.Descendants().Where(wP => wP.IsWebPage && wP.IncludeInMenu && wP.Depth <= (CurrentNode.Depth +1)).OrderBy(wP => wP.MenuOrder))
    {
 		if (navItem.Depth > CurrentNode.Depth && navItem.IsHomePage == true) 
        {
  			<li><a href="@navItem.Path">@navItem.MenuName</a></li> 
        }
        else if (navItem.Depth == CurrentNode.Depth) 
        {
          if (CurrentNode.Path == navItem.Path) {
            <li><a class="secondaryNav__active" href="@navItem.Path">@navItem.MenuName</a></li> 
          } else {
            <li><a href="@navItem.Path">@navItem.MenuName</a></li> 
          }
        }
}
</ul>