About     Search     Feed

Nilesh D Kapadia


Music     Twitter     Github

New site using Jekyll static site generator

I have switched from using Drupal for my blog to using Jekyll, a static site generator. Drupal has served me well for the last 6 years, but for this site it has been overkill and keeping up with the frequent security updates has been a chore.

How this works

What Jekyll does is use templates to generate static HTML pages. This means for each update to my site, I simply redeploy a new set of static HTML pages that I have generated using Jekyll. I am storing my site data in a Git repository. On the server, I use an update script to fetch the latest from Git, and generate the new version of the site.

I also store and work on my site data in my Dropbox folder. I work on this site on more than one computer, and relying on a SCM alone to synchronize would be way too cumbersome. Dropbox has been great for automatically synchronizing the project between machines, and seems to handle synchronizing Git metadata fine. I’m actually doing this for all my personal projects these days.

My old workflow with Drupal

My workflow for writing entries in Drupal was to edit posts in Emacs using markdown-mode (as I was using Markdown for posts, though initially I was using filtered HTML). Once a post was in Drupal, if I needed to make changes, I would use the Firefox extension ViewSourceWith to conveniently load the entry back into Emacs, edit it, then have it auto-load it back into the browser textbox once I was done editing. This worked, but it’s not as convenient or straightforward as editing a file sitting on my hard drive.

Advantages

With Jekyll, all posts are stored in files, so naturally the normal workflow is to edit files directly with a text editor. I expect this to be a lot nicer than working with a web interface.

Security is less of an issue with static HTML files. I only need to worry about security updates to the web server I am using, which is much less frequent than that of the typical PHP app such as Drupal (or Wordpress for that matter).

Though this site has never seen any heavy traffic that would test the limits of the server it was hosted on, I expect the performance of the static site to be much better than that of what a PHP / MySQL app can achieve (without proper caching at least).

I feel like I more empowered to customize and modify my site’s layout because it’s just HTML/CSS/JavaScript with a simple template engine (Jekyll uses Liquid).

Switched from shared hosting to a VPS

In this process I have also moved the site from a shared hosting provider to a Linux VPS (Linode). I am using nginx as the web server, whereas my previous host was using Apache.

Now that this is all in place, I need to get back to writing blog entries…

Script for Drupal to Jekyll conversion

It is in no way complete, but I wrote this script for converting Drupal posts to Jekyll: jekyll_drupal_conversion.rb

It is rather specific to my site, and may not work with someone else’s Drupal site, but could be a good starting point if you are looking for a conversion script. Be prepared to modify it if you plan to use this.

The script attempts to convert Drupal’s Filtered HTML format to normal HTML, but those HTML files probably needed additional work. It also attempts to convert the syntax highlighting tags I was using to those for Jekyll’s liquid tags which uses pygments, a Python based syntax highlighter. I actually ended up manually converting most of my HTML posts to markdown in the end.

© 2013 Nilesh D Kapadia