Handle paginatable object

Highlighted
Excursionist
45 2 2

Hi,

I'm not sure about the pagination in liquid. If I want to create an object which is paginatable, which requirements need to be fulfilled?

In principle I like to loop the search results and filter these. For furher processing I need to assign the filtered results but this new object is always not paginatable. Simply creating an array does not seem to do the job.

{% capture results %}
  {% for item in search.results %}
      {% assign product = item %}
      { 
        "title"    : {{ product.title | json }},
        "url"      : {{ product.url | within: product.collections.last | json }},
        "thumbnail": {{ product.featured_image.src | product_img_url: 'thumb' | json }}
      }
      {% unless forloop.last %},{% endunless %}
  {% endfor %}
{% endcapture %}

How could I paginate such an array?

Thanks and regards,

:)

0 Likes