Skip to content

Instantly share code, notes, and snippets.

@bcalloway
Created September 17, 2009 12:39
Show Gist options
  • Save bcalloway/188468 to your computer and use it in GitHub Desktop.
Save bcalloway/188468 to your computer and use it in GitHub Desktop.
Sub-Nav of child pages in Radiant
## In layout
<div id="subnav">
<ul>
<r:snippet name="sub-nav" />
</ul>
</div>
## In snippet named "sub-nav"
## This also adds an "active" class to the current page link
<r:if_parent>
<r:parent>
<r:snippet name="sub-nav" />
</r:parent>
</r:if_parent>
<r:unless_parent>
<r:children:each>
<r:if_ancestor_or_self>
<r:children:each>
<r:if_ancestor_or_self>
<li id="<r:slug/>" class="active"><r:link /></li>
</r:if_ancestor_or_self>
<r:unless_ancestor_or_self>
<li id="<r:slug/>"><r:link /></li>
</r:unless_ancestor_or_self>
</r:children:each>
</r:if_ancestor_or_self>
</r:children:each>
</r:unless_parent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment