Skip to content

Paginate

Splits an array's items across multiple pages.

The following arrays can be paginated:

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 %}
  • 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 %}

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 %}
liquid
{% paginate search.products by 24 cod %}
  {% for product in items %}
    forloop_content
  {% endfor %}
{% endpaginate %}