Your safety is important to us. If you notice any suspicious emails that appear to come from Shopify, please forward them to safety@shopify.com. Visit the Help Center page on phishing for more information.

The paginate object

The paginate tag's navigation is built using the attributes of the paginate object. You can also use the default_pagination filter for a quicker alternative.

Tip

The paginate object can only be used within paginate tags.

The paginate object has the following attributes:

paginate.current_page

Returns the number of the current page.

paginate.current_offset

Returns the total number of items that are on the pages previous to the current one. For example, if you are paginating by 5 and are on the third page, paginate.current_offset would return 10.

paginate.items

Returns the total number of items to be paginated. For example, if you are paginating a collection of 120 products, paginate.items would return 120.

paginate.parts

Returns an array of all parts of the pagination. A part is a component used to build the navigation for the pagination.

paginate.next

Returns the part variable for the Next link in the pagination navigation.

Input

{% if paginate.next.is_link %}
    <a href="{{ paginate.next.url }}">{{ paginate.next.title }}</a>
{% endif %}

Output

<!-- If we're not on the last page, and there still needs to be a Next link -->
<a href="/collections/all?page=17">Next »</a>

paginate.previous

Returns the part variable for the Previous link in the pagination navigation.

Input

{% if paginate.previous.is_link %}
    <a href="{{ paginate.previous.url }}">{{ paginate.previous.title }}</a>
{% endif %}

Output

<!-- If we're not on the first page, and there still needs to be a Previous link -->
<a href="/collections/all?page=15">« Previous</a>

paginate.page_size

Returns the number of items displayed per page.

paginate.pages

Returns the number of pages created by the pagination tag.

Want to discuss this page?

Visit the Shopify Community