Paginate
Splits an array's items across multiple pages.
The following arrays can be paginated:
categories
products
search
Within the paginate tag, you have access to the paginate object. You can use this object to build page navigation.
liquid
{% paginate array by page_size cod %}
{% for item in array %}
forloop_content
{% endfor %}
{% endpaginate %}
1
2
3
4
5
2
3
4
5
array
: The array to be looped over.page_size
: The number of array items to include per page.item
: An item in the array being looped.items
: A special keyword representing the iterable items.forloop_content
: Content for each loop iteration.
Examples
Products
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
Collections
liquid
{% paginate collections by 8 cod %}
{% comment %} In case there are sub-categories {% endcomment %}
{% for collection in subCategories %}
forloop_content
{% endfor %}
{% for collection in items %}
forloop_content
{% endfor %}
{% endpaginate %}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Search
liquid
{% paginate search.products by 24 cod %}
{% for product in items %}
forloop_content
{% endfor %}
{% endpaginate %}
1
2
3
4
5
2
3
4
5