Sorting collections in Liquid templates
03 April 2013Sorting in Jekyll looks quiet simple with standard Liquid Filters sort, but it did not worked out.
Because Liquid converts ruby hashes to arrays, e.g the Jekyll variables beneath site, like categories and tags (e.g. site.tags):
for tag in site.tags
<li></li>
endfor e.g. site.tags will be converted to an array of tuples in which [0] refers to the key and [1] to the list of values. Without monkey patching you can not sort the tuples alphabetically by the key [0] of each of them - very sad!
There’s a pull request that adds it at Shopify/liquid#101, but it looks like that’s not been merged (see also mojombo/jekyll#766) ;-(