Posted on 25 Mar 2015
Tags: meta

Now that there’s enough content posted to at least make their presence useful, if far from necessary, I’ve added tags to my posts. So that this metadata is not just treated as more data, I’ve made the corresponding changes to the hakyll site generator and templates. You can, for example, see all the posts I made concerning statistics laid out in a list.

Most of functionality is already there in the Hakyll.Web.Tags module, but integrating it is a bit complicated. I followed Javran’s extremely clear tutorial, with only two minor changes1.

I also added a tag cloud visualization to the home page. I don’t feel like taking a didactic approach now, but it essentially just requires using the same tags <- buildTags "posts/*" (fromCapture "tags/*.html") statement to grab the tags, adding the field tagCloudField "tag-cloud" 80 125 tags2 to indexCtx, and putting the $tag-cloud$ template code where the cloud is to be interpolated.

  1. In templates/post.html, I place date, author, and tag info in the same div. In the site.hs, I used the statement let postCtxTagged = postCtxWithTags tags for historical reasons.

  2. The magic constants 80 and 125 are the range of font sizes for the tags, in percent. This maintains bioequivalence with not resizing them at all.