Jekyll

I’ve now switched the creation of this web-site from Enki to Jekyll. This effectively means that since 2005 I’ve managed to go full circle. I started with flat PHP files, then switched to WordPress, tried Mephisto before settling on Enki. The Enki version that I started at the beginning of 2009 was one that I customised the most having the ‘Extras’ sections generated using machine tags and a cron job. It all worked fine, apart from New Relic reporting an ‘unacceptable’ Apdex score every week.

I read a while ago that Brent Simmons generated the web-pages for inessential.com on his local machine and then just uploaded the HTML. Then recently Gruber suggested that pre-baked sites would be the best alternative because serving the pages can be fast, it’s the generation and database access that can bog things down. WordPress doesn’t have page caching by default but Movable Type does, which is what John uses for daringfireball.net. I even considered using Movable Type but never got as far as downloading the code. Being able to run multiple web-sites from the one installation did seem quite tempting.

Switching to Jekyll was fun and pain free. I just wrote a Ruby script to save all my posts and pages from the Enki database and then started creating liquid template files. I downloaded a few examples from GitHub but the one that I looked at the most was Jekyll’s First Potion. I did attempt to switch everything over to HTML5 after reading Jeremy Keith’s book but only switched the doctype. The stylesheet is pretty much the same, the only things that have gone are the machine tags and the section at the bottom of the main page with the links to recent additions to flickr, huffduffer etc.

Each blog post is a separate markdown file in a folder. The files have a YAML section at the top to indicate the layout to use, title and extra metadata. At the moment I just run the Jekyll command from a terminal window and it generates the entire site in less than 30 seconds. It actually takes longer to upload all the files to the server.

I think it’s an elegant, simple solution. You don’t have to have an expensive hosting package, you don’t need to keep it backed up, this is all in a Git repo on GitHub. In fact with Amazon announcing that you can host static pages from an S3 bucket I may switch to them for hosting. I’ll only be paying for the traffic to the site. Luckily there’s no chance that this will get fireballed.

Update
I’ve now added extra rake tasks copied from a rakefile on Github which uses rsync to upload it to the server.

  • Posted on Thursday, 31 March 2011
  • Tagged with CMS web