get_siblings ()

Get the previous and next record in this record's parent's list of children.

The returned object has attributes prev_page and next_page. Each can be a Record or None.

If the parent record has pagination enabled, then use the pagination query to filter and order the children. Otherwise, the parent's standard configuration for children is used. See the pagination guide and the page order guide.

Example

{% set siblings = this.get_siblings() %}

{% if siblings.prev_page %}
  <a href="{{ siblings.prev_page|url }}">previous</a>
{% endif %}

{% if siblings.next_page %}
  <a href="{{ siblings.next_page|url }}">next</a>
{% endif %}

See also: has_prev and has_next.

Comments