Resetting shop

After having set up this site as a Jekyll-Blog last year, I was quite happy with what I had worked out for blogging. If you want to know, you can look it up in this article. But after not having an eye on the site for some month all hell broke loose and I had to start over.

The crisis

Two weeks ago I finally had time again, after some stressful month privately and at work and wanted to pick up blogging again. Much to my dismay, since last using Jekyll, the Ruby and Jekyll versions changed significantly and I had already upgraded Ruby and left the whole system in an non-compiling state. This was especially inconvenient since I know almost no Ruby and am even less able to debug strange problems with the packaging system.

Twitter to the rescue

One tweet:

and especially one answer

later, I knew about Hakyll. And since I know Haskell far better than Ruby it was a done deal to switch over.

The challenge

Obviously I wanted to have (at least) the same functionality with Hakyll I had been able to piece together with Jekyll. This included the:

and if possible I’d like to have it easier, more robust, even more bells and whistles and fairy dust. Which should all be very well within the limits of what I could achieve with Haskell.

Yes, including the fairy dust.

The (new) setup

So here is the basic setup. Since my awesome hosting provider uberspace has a ruby environment set up automatically I could write blog posts locally, git commit and git push them and have a post-receive hook generate the page server site. The same can, unfortunately, not be said for a Haskell environment. And since I deemed it a little overkill to put one up, just for the purpose of blogging, I decided to do more work locally. So now I’m write and compile the site locally and deploy it via Hakylls deploy command, which wraps a call to rsync over ssh.

As you can see from the sites linked further up still working, I maintained all the functionality mentioned above.

For the MathML part this was rather easy since pandoc, the underlying compiler for Hakyll, already provides you with compilation to MathML out of the box. You merely have to switch it on, or better not switch it off.

For the responsive video functionality I went a little fancy and wrote small Parsec parser and while at it added responsive Slideshare embedding and a Tikz to SVG converter. Which allows me to write standard tikz code and have it automatically compiled to an SVG and embedded in place (as long as your browser supports it and it is not to complex).

For the talk page I wrote some general filter code, which I am currently using only for filtering talks, but you never know what good this might be for later.

And finally for the bucketed archive pages I also wrote a little code, which is not as general as I would like it to be, but that might change.

If you are interested you can get the source code at github. And I will devote some blog posts to the video and slideshare embedding, the tikz compiler, the filtering and the bucketing over the course of the next few days.

Conclusion

After only 6 hours I had ported almost all of the functionality I had on my Jekyll page to Hakyll. With a code quality about comparable to the one in the Ruby site. In other words some rounds of refactoring where in order. But after devoting about an hour each day to refactoring the last week, I’m now pretty happy with the result.

The worst thing of all is that I hadn’t found Hakyll earlier. That could have saved me some valuable time.