Page-Based Subnav

Author: Webvanta

Generates a subnav list based on the page hierarchy (not the menu hierarchy). This is designed for sites with a two-level page hierarchy.

If the current page has children (subpages), then this is a top-level page, and the subnav list shows each of subpages.

If the current page does not have any children, then presumably it is a subpage, so the subnav shows the other subpages of the same parent. The w:if_self statement adds a class to the menu item for the current page.

<ul>
   <w:if_children>
     <w:children:each>
       <li><a href='<w:url />'><w:meta:title /></a></li>
     </w:children:each>
   </w:if_children>
   <w:unless_children>
     <w:parent:children:each>
       <li><a href='<w:url />' <w:if_self>class='subnav-selected'</w:if_self>><w:meta:title /></a></li>
     </w:parent:children:each>
   </w:unless_children>
</ul>