Case-insensitive Tag Sorting on GitHub Pages
I haven’t seen a complete solution on the internet which satisfied me. Originally I settled on the partial solution by codeinfox: https://codinfox.github.io/dev/2015/03/06/use-tags-and-categories-in-your-jekyll-based-github-pages/. But I realized we could do better with a little effort.
The resulting code is being used by this blog and is therefore available on GitHub: tags.html. At a high level, we do the following. First, create a list of all the tags from all the posts (
rawtags). Second, remove duplicates and blanks (
alltags). Next, convert to lowercase and sort (
lowertags). Then build a new list of tags by iterating over
lowertags and picking the un-lowercased version of the tag from
It’s not super-efficient (O(n^2) but since it’s a static site generator I can live with it.