Experimenting with Hakyll


Notes on setting up my personal site using the Hakyll static site generator.
Las updated on July 1, 2015 by Jacob West
Tagged :: hakyll, haskell, web

I recently decided to rebuild my personal website from the ground up.

I knew that I wanted to self-host and that most of my content would be static, so a static site generator seemed to be the natural choice. A static site generator is a program that reads text files of some sort (often in markdown format) and produces html files containing the original text content. The main idea is to generate web-friendly content and URL structure from an otherwise human-friendly format and directory structure. Setting up the static generator and associated infrastructure may seem like more work than strictly necessary for a simple personal website and that may very well be true, but the hope and justification is that a clean separation between content and code allows the site to change with minimal effort while leaving the content intact, i.e. it’s an investment in the future. Whether or not this effort constitutes a worthwhile investment for me personally remains to be seen.

It turns out there are many, many static site generators in the world. I am currently also in the process of “going fully functional” (whatever that means) with all of my computing systems, so for me the choice was easy: I had to use Hakyll.

Hakyll is an open source static site generator originally written (and still maintained) by Jasper Van der Jeugt, using the functional programming language Haskell. Hakyll cites the static site generators yst, nanoc and Jekyll as inspiration, although I wouldn’t read into this too much. Hakyll is implemented as a Haskell DSL (domain specific language), so the actual setup and usage of Hakyll as compared to other static site generators is undoubtedly quite different. At this stage, my Hakyll setup is fairly vanilla and I still have very little experience using it to power my site, so I’ll postpone any further opinions until a later date.

Instead, the remainder of this post will serve as a home for a small collection of notes-to-self about my Hakyll setup and what I might like to do with it in the future. Right now, I have the basic scaffolding I wanted in place: a generated main page with recent activity, tags, writing and teaching aggregate pages, and a generated about page. However, there are many other features I might still like to add, including (but not limited to):

  • a mobile menu and/or permanent title bar
  • rss/atom feeds
  • comments (disqus powered?), possibly per-paragraph
  • revision history / versioning on every page
  • nice syntax highlighting for code
  • incorporate activity from outside the site (github, twitter, comments on other sites, etc) into the recent activity section (a limited life stream of sorts)

I have seen examples on the internet that incorporate these features, so it’s not a matter of whether any one of these are possible but rather if they are worth the time-investment required.

Time will tell, I suppose.