Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
(asking again because I didn't get any replies on my previous 2 posts and Shopify support staff refuses to provide support)
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.
{% 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?
Solved! Go to the solution
This is an accepted solution.
Generally speaking, you can gather all your posts into a JSON array by fetching the results of each paginated page, then sort that by the updated_at field. Then output the articles and add a javascript-based pagination system. If you have a ton of posts, this could get slow, but you can try to cache the results in localStorage or something so only the first load is slow.
BUMP
You can't mess with the pagination/sort of blog posts with liquid. You can do some hacky things with javascript though.
This is an accepted solution.
Generally speaking, you can gather all your posts into a JSON array by fetching the results of each paginated page, then sort that by the updated_at field. Then output the articles and add a javascript-based pagination system. If you have a ton of posts, this could get slow, but you can try to cache the results in localStorage or something so only the first load is slow.
Awesome! Thanks, I’ll dig into that and see what I can find.
Could you please get into more detail? I tried the same as Jao and did not succeed. My goal is to create a dictionary with blog articles. Currently 80 articles so far, but slowly expanding. Currently I only get 50 "random" articles, when fetching {% assign sorted_articles = blog.articles | sort: 'title' %}
My goal is to display the first 50 articles on one page, then the next 50, etc. in alphabetical order. Javascript pagination is only a viable solution if it may be crawlable by google.
I tried it with tagging, so that the search crawler at least gets all of the articles and not only a subset, which seems to be random or maybe based on update-date?
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025