Skip to main content

r:siblings

<r:siblings:{attr} />

A tag used to loop through sibling pages.

Attribute Options

limit="3" - Limits how many results are returned in the loop.

random - Boolean. Valid options are true or false. Pulls a random sibling page every 30 seconds from within the loop.

Example:

<r:siblings:each limit="3" random="false">
  <r:page:name />
</r:siblings:each>

page.siblings

A tag used to loop through sibling pages.

Note: this tag is technically part of the page.{attr} drop. Be sure to check out the documentation for page.{attr} .

Attribute options

previous_sibling - Get the previous sibling. Returns an array. Use another drop to get the information you want (eg: page.previous_sibling.url)

next_sibling - Get the next sibling. Returns an array. Use another drop to get the information you want (eg: page.next_sibling.name)

Examples

{{ page.previous_sibling.url }} <!-- https://example.wvu.edu/regular-page -->
{{ page.next_sibling.name }} <!-- How to Apply -->

Make a "Previous Page / Next Page" pager:

<ul class="pager">
  <li class="previous"><a href="{{ page.previous_sibling.url }}">&larr; {{ page.previous_sibling.name }}</a></li>
  <li class="next"><a href="{{ page.next_sibling.url }}">{{ page.next_sibling.name }} &rarr;</a></li>
</ul>

Get three sibling pages using a loop:

{% assign siblings = page.siblings | filter_pages: limit: 3 %}
<ul>
  {% for sibling in siblings.all %} <!-- or siblings.first / siblings.last -->
    <li><a href="{{ sibling.url }}">{{ sibling.name }}</a></li>
  {% endfor %}
</ul>

Note: You can also use descendants, ancestors, children on the page drop. Eg page.siblings would become page.descendants.

Last updated on March 16, 2021.

We welcome all questions, feedback and bug reports. If you're having an issue, we usually need the following information:

  • A brief description of the issue
  • A link to the page where you saw the issue
  • Screenshots that illustrate the problem - How do I take a screenshot?

Kindly email CleanSlate@mail.wvu.edu for help or use the form on the request help page.