Paginate
The paginate
object provides pagination information and helpers inside the paginate
tag. Use it to build paginated navigation and display page details.
Usage Example
{%- paginate product_group.products by 20 -%}
<ul>
{% for product in product_group.products %}
<li>{{ product.title }}</li>
{% endfor %}
</ul>
<nav>
{% if paginate.previous.is_link %}
<a href="{{ paginate.previous.url }}">{{ paginate.previous.title }}</a>
{% endif %}
Page {{ paginate.current_page }} of {{ paginate.pages }}
{% if paginate.next.is_link %}
<a href="{{ paginate.next.url }}">{{ paginate.next.title }}</a>
{% endif %}
</nav>
{%- endpaginate -%}
Properties
page_size
The number of items in the current page.
current_page
The number of the current page.
current_offset
The total number of items on the pages previous to the current page.
pages
The total number of pages in the pagination.
items
The total number of items in the pagination.
parts
An array describing each part of the pagination (for advanced navigation).
previous
An object describing the previous page link:
is_link
: true if there is a previous pagetitle
: the link text (usually “Previous”)url
: the URL for the previous page (or null if not available)
next
An object describing the next page link:
is_link
: true if there is a next pagetitle
: the link text (usually “Next”)url
: the URL for the next page (or null if not available)
Last updated on