Paginate
Last updated View as Markdown
Splits a list into pages.
These lists can be paginated:
collection.products, for any collection, includingcollections['all'].productscollectionssearch.resultscustomer.orders
Inside the tag, the list holds the current page only, and the paginate object describes the pages.
liquid
{% paginate list by page_size %}
{% for item in list %}
forloop_content
{% endfor %}
{% endpaginate %}1
2
3
4
5
2
3
4
5
list: the list to paginate, for examplecollection.products.page_size: the number of items per page, from 1 to 250. A number or a variable.
The page comes from the page query parameter, for example /collections/shoes?page=2.
Examples
Products of a collection
liquid
{% paginate collection.products by 24 %}
{% for product in collection.products %}
{% render 'product-card', product: product %}
{% endfor %}
{% for part in paginate.parts %}
{% if part.is_link %}
<a href="{{ part.url }}">{{ part.title }}</a>
{% else %}
<span>{{ part.title }}</span>
{% endif %}
{% endfor %}
{% endpaginate %}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Every product
liquid
{% paginate collections['all'].products by 24 %}
{% for product in collections['all'].products %}
{% render 'product-card', product: product %}
{% endfor %}
{% endpaginate %}1
2
3
4
5
2
3
4
5
Collections
liquid
{% paginate collections by 12 %}
{% for collection in collections %}
<a href="{{ collection.url }}">{{ collection.title }}</a>
{% endfor %}
{% endpaginate %}1
2
3
4
5
2
3
4
5
Deprecated form
The older form names a fixed list and an id, and exposes the page through items:
liquid
{% paginate collection.products by 24 cod, category_id: category.id %}
{% for product in items %}
forloop_content
{% endfor %}
{% endpaginate %}1
2
3
4
5
2
3
4
5
It still works, but new themes should use the form above. For search, use search.results. The older form also sets the paginate object. Its page parameter is page[<id>], for example page[cod]. Its other variables are listed on the same page.