From WordPress to Jekyll
April 10 2009Over the last week or so, I’ve migrated this blog from WordPress to Jekyll - a ‘blog-aware static site generator’, written in Ruby.
Jekyll takes a directory of posts and layouts, runs them through various converters, and produces a static website. Posts are stored in plain text files written in Markdown which makes it super easy to write HTML documents without the need to actually write HTML (and thus lose your flow). For example, making bold text is as simple as **this**. When Jekyll runs, it takes these posts, converts them into HTML, inserts them into an HTML layout, and produces a static HTML file. It’s really rather neat. If you want to see an example of how the back-end’s organized, check out this example of a Jekyll website on GitHub.
The main advantages, for me, are:
- It’s much faster than a PHP/MySQL based website like WordPress. You can’t really get much quicker than plain ol’ HTML files. There’s nothing for the server to process other than serving up the files the user requests.
- Posts are all stored in plain text files, which means they’re instantly accessible and usable anywhere I may want them - I don’t need to worry about having to export/convert posts from a database. I can also write my blog entries in my favourite text editor, TextMate - which is good, as I really don’t like blogging via a tiny textarea on a web page.
- Because the posts are in plain text, I can very easily version control my entire site; everything’s kept neatly in a Git repository and I can roll back to any previous version of any file/post if I need to.
- It’s ultimately a much simpler, smaller solution than using WordPress: I know exactly what’s in every file that makes up my website (and there really aren’t that many of them). WordPress is a much more complex system, and I really don’t know what half of it does or how it works.
- It makes blogging fun again!
One downside of static files is that this means that the site can’t run its own commenting system. However, I’m using Disqus (a javascript solution) which seems ok. It’s a little more intrusive than I’d like, but I can live with it.
Using Git allows me to automate the regeneration of my site when I write a new entry. I write the post in a local clone of the site’s Git repo (or, on my server if necessary), commit my changes, and push them to the master repository on the server. When the server receives the changes, a handy little Git post-update hook that I wrote pulls the changes into the ‘live’ repository, and runs Jekyll to regenerate the site. It’s rather cool.
Now to work on:
A. Writing more.
B. Writing better.