Show All Posts From All Blogs In Chronological Order In A Shopify Liquid Template
According to my research Shopify’s suggestion for implementing categories is to create a separate blog for each Category. Then, if you want to show all posts from all blogs you have to loop through each blog’s articles, one blog at a time, resulting in a list of all Blog 1, then all Blog 2, etcetera.
A client wanted to show all posts from all categories/blogs in one chronological list. Searching online I couldn’t find any code that did this so I wrote something myself. It does require you to add your blog/category handles, but this is a feature! 🤣 You have control over which blogs/categories are included.
As you'll see, first a list of "identifiers" for all articles is created using a loop, then that list is sorted so the most recent articles are first. Finally a loop outputs all the articles. In this example a limit of 20 is set but you can change that for your own purposes.
I hope this helps someone! If it helps you I'd love to hear about it.
Have a question or comment about this post, or just want to say hi? Drop me a line
Later Post: In it to grin it :-)