Migrating to Jekyll
I’ve decided to switch my blog from WordPress to a Jekyll-based system. When this article goes live, the migration should be done. I hope I managed to avoid flooding the planets that aggregate me with old articles (Planet Igalia, Planet GStreamer and Planet GNOME), if I failed, I apologise, feed aggregators are a bit like dark magic to me.
CC BY-NC-SA 2.0 by Kevin Lim
The main motivation behind that is that is that I am very tired of the WordPress editor. I am a programmer and spend my days using the same editor1, which means that I have gotten rather efficient using it, or, at least, that’s the way of writing text that is the most comfortable to me.
In a stock WordPress installation, all you could do to edit your blog post in your own editor is to edit it in HTML and then cut and paste your result in the editor and publish. HTML. Eeek! I don’t want to be editing a tag soup, I want to focus on the content. There are better languages than HTML for that, such as reStructuredText or MarkDown. I did try WordPreSt a while ago but wasn’t satisfied with the work flow it provided, and if I remember correctly, I ended up having to correct things manually.
So, reading up a bit on the internets on what’s available, I got seduced by the concept of jekyll and its principle of offline generation of static pages, and the default workflow is very similar to the one I am used to when doing software development. Also, it seems to be actively maintained and used in GitHub Pages, which gives me a feeling that it’s here to stay. The only drawback that I see to it is that commenting cannot be handled by strictly static web pages. Most people using jekyll for blogging seem to resort to using external commenting services, such as Disqus and friends or even facebook, but I’d rather not depend on an external service for that. I’ve found a solution to that that seems decent to me, and I explain this in a later section.
Jekyll in itself is not a blogging system out of the box, but a good tool to make one. Since I didn’t feel like reinventing the wheel, I am using Jekyll-Bootstrap as a base for my blog.
Conversion of posts
I’d rather leave my old articles online, while still not have to manage a WordPress installation, so I definitely want to migrate my old articles to the new system. Luckily, jekyll comes out of the box with migration tools to make your life easy. I’ve used the tool that gets the content from a Wordpress export file and it went (mostly) like a breeze, as far as I could check. I only had to modify a bit the image caption code in one article. I still have some image files that aren’t where they should be in old posts, but that was already the case with WordPress. I will need to fix these articles at some point.
The issue that I had left to deal with is to be able to have comments, and to import the comments I had in WordPress. I chose to use Jekyll::StaticComments (code here for that purpose. It is a plugin for Jekyll that takes comments in YAML files and renders them at the end of a post. That still left me with two problems: how do I migrate old comments from WordPress, and how do I let people add new comments?
I’ve written a quick and dirty script with BeautifulSoup that gets the comment from a WordPress export file and generates a suitable tree of YAML files for use by Jekyll::StaticComments. I’ve put it online and called it wp2jekyll-comments.
Adding new comments
Jekyll:StaticComments comes with a PHP script that allows one to submit comments. Since I’m an awful geek, I don’t like much the idea of having to use PHP here, so I made my own version of it in Python. I’ve published it as jekyll-comments.