Paginate over liquid variable

New Member
2 0 0

I've found online in a few places stating that you cannot use paginate on a liquid variable, only directly on collection.products.

 

I've had an issue where I need the homepage to be the same as /collections/all, and my solution was to just have a big snippet for all my products and import it into index.liquid:

// templates/index.liquid
{% include 'collection', products: collections['all'].products %}
// templates/collection.liquid
{% include 'collection', products: collection.products %}
// snippets/collection.liquid
{% paginate products by 9 %}
  {% for product in products %}
    {{ product.title }}
  {% endfor %}
{% endpaginate %}

But this causes an error:

Liquid error: Array 'products' is not paginateable.

 

Is there any alternative solution to this?

Why is Liquid so limited with such basic things - it's been a really big pain whilst working with a theme from scratch.

 

Edit:

So the collection.liquid pages work, just not the index which passes in

collections['all'].products
0 Likes
Highlighted
New Member
2 0 0

Similiar problem here.

I'm trying to paginate a Linklist that is composed out of the Page object.

Does the paginate only work on Collection,Blogs or is it available for other objects too?

0 Likes