If you're view a child page, how do you get the next "sibling" ?
Page "My Colors"
Child Page "Red"
Child Page "Green"
Child Page "Blue"
If I'm on page "Green" what is the easiest way to get the data for page "Blue"?
The easiest way to do this is to have "Include in top nav" checked for the parent and subpages. That will add them to a drop down menu, and it will also add a subnav of the subpages to the top of the content area. An example of this is the NationBuilder FAQ page.
If you don't want the pages to be in a drop down, or to be included in the top nav, you can edit the subpage (aka child page) template so the subnav is shown even if you "Include in top nav" isn't checked. Just replace this:
{% include "breadcrumbs" %}
With this:
<div class="subnav_container" id="subnav_container">
<div class="navbg">
<ul id="subnav">
{% for child in page.nav_children %}
{% if child.leaf? or child.nav_children.size == 0 %}
{% if child.is_or_is_ancestor_of_current_page? %}<li class="active">{% else %}<li class="nodrop">{% endif %}
<a href="{{ child.url }}">{{ child.name }}</a>
</li>
{% else %}
{% if child.is_or_is_ancestor_of_current_page? %}<li class="active_drop">{% else %}<li class="drop">{% endif %}
<a href="{{ child.url }}">{{ child.name }}</a>
<div class="sub">
<ul>
{% for child2 in child.nav_children %}
<li><a href="{{ child2.url }}">{{ child2.name }}</a></li>
{% endfor %}
</ul>
</div>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
<div style="clear: both;"></div>
Showing 9 reactions
Sign in with
Certified Architect
Certified Expert
Certified Developer
hopefully you can discern what that means?
Certified Architect
Certified Expert
Certified Developer
Certified Architect
Certified Developer
Certified Architect
Certified Developer
Certified Architect
Certified Developer
/cain is a page. /able is a page. They are both descendants of /adam
How do I print /able ’s title (or any other object) within the /cain page? Is there a good solution for referencing a page via a sibling?
Certified Architect
Certified Developer
Certified Architect
Certified Developer