Sort & Paginate blog posts

jao
Excursionist
17 0 1

I'm trying to create a paginated list with blog articles that are sorted by time of update.

But it results in this error:

Liquid error (sections/blog-template.liquid line 72): Array 'blog_posts_sorted' is not paginateable.

This is the relevant liquid code:

 

{% assign blog_posts_sorted = blog.articles | sort: "updated_at" %}

{%- paginate blog_posts_sorted by articles_per_page -%}

How do I paginate a sorted list of blog articles?

0 Likes