The navigation of the paginate tag is built from the attributes of the paginate object. For a quicker alternative, use the default_pagination filter.
The paginate object can only be used inside paginate tags.
The paginate object has the following attributes:
paginate.current_offset
Returns the total number of items on the pages before the current page. For example, if you paginate by 5 and are on the third page, paginate.current_offset returns 10.
paginate.current_page
Returns the number of the current page.
paginate.items
Returns the total number of items to paginate. For example, if you paginate a collection of 120 products, paginate.items returns 120.
paginate.parts
Returns an array of all parts of the pagination. A part is a component used to build the pagination navigation.
paginate.next
Returns the part variable for the Next link in the pagination navigation.
{% if paginate.next.is_link %}
{{ paginate.next.url }}
{% endif %}
<!-- If we're not on the last page, and there still needs to be a Next link -->
/collections/all?page=17
paginate.previous
Returns the part variable for the Previous link in the pagination navigation.
{% if paginate.previous.is_link %}
{{ paginate.previous.url }}
{% endif %}
<!-- If we're not on the first page, and there still needs to be a Previous link -->
/collections/all?page=15
paginate.page_size
Returns the number of items shown per page.
paginate.pages
Returns the number of pages created by the paginate tag.
More properties
VersaCommerce also provides these properties on the paginate object:
| Properties | Returns |
|---|---|
page_param, collection_name |
Pagination query parameter and collection identifier |