Skip to main content

How to get next page

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"?

Official response from

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>

Share this post

Showing 9 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.