How to alphabetically sort articles in Shopify


There doesn’t seem to be an easy way to sort articles in Shopify by title.

Inspired by this article, I developed a workaround for a single page of articles (i.e. with no pagination).

The procedure is as follows:

  1. Get Liquid to output all the HTML for the articles
    1. Give the root node of the list an id to reference later.
    2. For each article, set the class attribute to be what you want to sort on later.
  2. Use jQuery to grab the articles and do a sort based on that class value.
  3. Then append that sorted list back to the root node.

https://gist.github.com/magician11/0f400da0d1efed676314


Leave a Reply

Your email address will not be published.