Hakyll Setup

21 Oct 2011colophoniahaskell

As blogging software, I use the really rather nice Hakyll, by Jasper Van der Jeugt. This is a static website generator written in Haskell, and it’s a great solution for smaller blogs or personal websites.

Hakyll works just fine out of the box, but the blog setup I wanted was a bit different from what I’ve seen other people do with it, so a bit of hacking was required. I wanted to share some of the things I’ve done, since they might be of interest to other Hakyllers (Hakyllites?). All the code is available on Github.

I was going to write some sort of extensive description of what I’d done, but it makes more sense just to point at some places in the code. There are three source files, blog.hs which has all the main Hakyll-required definitions, Overrides.hs which contains definitions of some functions from the Hakyll libraries that I override, and TikZ.hs which contains my slightly rough around the edges code for converting images represented as TikZ code into SVG for inclusion in web pages.

Here are the “highlights”:

I’m not exactly the world’s best Haskell programmer, and some of this stuff could do with some polishing. The processTikZs function in TikZ.hs in particular is a bit grim, including a use of the pattern (id &&& f) >>> (arr (\(x, fx) -> blah x fx)) that I seemed to find myself using often enough that it looked like there ought to be a standard combinator for it, but for which I couldn’t find one in Control.Arrow. It’s the first time I’ve used arrows though, so I was just happy to end up with something that worked!

For what it’s worth, all the code is free for reuse.