Tags in GitHub Pages

I had this Jekyll site almost ready to go before I decided to use GitHub Pages. One thing that I lost in going with GitHub pages was my tagging code. This happened because GitHub Pages does not support custom Ruby code, which is what drove my tag generation. Luckily, I found Jekyll Tags on Github Pages, which I followed almost completely (minus the tag cloud section).

One difference is that I wrote my own tag page generation script, instead of using the one in that post.

#!/usr/bin/env bash

tags=`find _posts -type f | xargs grep "tags:" | cut -d[ -f2 | cut -d] -f1 | tr , '\n' | sed "s/^[ ]*//" | sort | uniq`

for tag in $tags; do
    echo Making tag file for \"$tag\"
    printf -- "---\nlayout: tagpage\ntitle: \"Tag: $tag\"\ntag: $tag\n---\n" > tag/"$tag.md";