Jekyll: Blogging like a hacker

17 Aug 2009

I wrote the first post on this site in 2005 using Serendipity. While Serendipity is a completely adequate blogging engine, I have been annoyed by a few things. All of them would apply to any popular blogging engine, which is why I wanted something different. I have now found a tool that takes a very different approach.

Before I go into that, let’s list the things that didn’t feel right with a “classical” blogging engine:

  1. Serendipity is written in PHP. This is good since there are plenty of ISPs that can host PHP sites. Unfortunately I’m no PHP hacker myself, so it is not easy for me to change the internal workings of the site.

  2. I have more interesting things to do than keeping up with the latest versions of the software. It is especially worrying if I don’t have the time to install security patches. This would apply no matter what blogging engine i chose. As long as there is server-side code, there is a risk of security holes.

  3. I’m a programmer. I’m used to working with text files. I can manipulate them with tools for version control, utilities like grep and sed, programming languages like Python and Ruby and any text editor of my liking. Entering text into a form on a web page may be easier for a non-programmer, but I have other usability requirements. (Also, with a web form text can easily get lost. I’ve been saved by tcpdump more than once.)

Enter Jekyll. It works on very simple premises. A blog post is a file. Plain and simple. It’s not hidden in a database on your ISPs server. You can edit and manipulate the file with any tools you like. You can write the code in HTML if you want, but most of the time I prefer Markdown which is also supported (or in fact encouraged).

Here’s what the file for this blog post looks like:

---
layout: post
title: "Jekyll: Blogging like a hacker"
tags:
  - jekyll
  - blogging
---
I wrote [the first post](/2005/05/26/PS3-and-parallell-programming/) on this
site in 2005 using [Serendipity](http://www.s9y.org). While Serendipity
is a completely adequate blogging engine, I have been annoyed by a few things.
All of them would apply to any popular blogging engine, which is why I
wanted something different. I have now found a tool that takes
a very different approach.

Before I go into that, let's list the things that didn't feel right with a
"classical" blogging engine:

1. Serendipity is written in PHP. This is good since there are plenty of ISPs
that can host PHP sites. Unfortunately I'm no PHP hacker myself, so it is not
easy for me to change the internal workings of the site.

2. I have more interesting things to do than keeping up with the latest versions
of the software. It is especially worrying if I don't have the time to install
security patches. This would apply no matter what blogging engine i chose. As
long as there is server-side code, there is a risk of security holes.

3. I'm a programmer. I'm used to working with text files. I can manipulate them
with tools for version control, utilities like grep and sed, programming
languages like Python and Ruby and any text editor of my liking. Entering text
into a form on a web page may be easier for a non-programmer, but I have other
usability requirements. (Also, with a web form text can easily get lost. I've
been [saved by tcpdump](/2008/12/02/Saved-by-tcpdump/) more than once.)

Static pages, like my contact page are generated from similar files. When I run the jekyll command, Jekyll reads all the files and generates static HTML files that can then be uploaded to the ISP. This means no server-side code and no security vulnerabilities. A blog is basically a bunch of static pages, so for a blog with low update frequency, there should be no need to store the posts in a database. And for a high traffic site, static files is very likely to give better performance.

The comments are the only dynamic part of this site. For those I use Disqus. It is convenient not to have to worry about spam protection and server-side security holes. Hopefully the Disqus people have more time on their hands to handle that.

The downside of Jekyll is that is is a fairly new project which is far from 1.0 status yet. Features are added, changed and even removed and some functionality is limited. That said, Github uses it in production to generate hosted pages.

If you’re interested in Jekyll, visit the site or the project page.

I based the theme on my site on Scribbish, which is a blog theme originally designed for Typo. My port is available here, but it currently requires my fork of Jekyll, which adds some functionality that I need. I’m pushing for those changes to be included in the mainline Jekyll code.

That’s it. Let me know what you think of my new site!

blog comments powered by Disqus