Digital Sanctum

Personal blog of Shane Witbeck Tags · Archive · About

WordPress to Jekyll

Published: 18 Nov 2009

I’ve just completed moving this blog from WordPress to a static site generated using Jekyll.

Why the move?

Here are a few reasons why I decided to make the move:

  1. minimalism - I try to keep things simple. Publishing via my favorite text editor and a simple command line publishing interface is a nice change from the bloated and dumbed-down WordPress editor. This allows me to be more focused on what I’m writing.
  2. speed - although you can cache content in WordPress via plug-ins, the speed of static content still cannot be matched.
  3. elimination of risk - although WordPress is still regarded as the best and most widely-used blogging software out there, it’s still plagued with the occasional security hole. These are generally rectified fairly fast through point releases but still requires the site owner to keep the site running with the latest and greatest version. There is virtually no risk with a static site.

Overview of the transition

The transition was relatively easy with just a couple of hiccups.

The first hiccup was getting the MySQL gem installed on my OS X workstation. Once the mysql and sequel gems were installed it was a matter of configuring a Ruby script to connect to my existing WordPress database. Once this was done, it took literally a couple of seconds for the script to read all my existing WordPress posts from the database and create Markdown files.

The second hiccup wasn’t really an issue but a bit of housekeeping which was tedious but necessary. Jekyll will spit out messages regarding badly formed markup as it takes the content you write and generates HTML. This is a great way to be sure your markup is up to par but was time-consuming to go through each of my posts and clean them up. I converted some of the heavy HTML created by WordPress’s GUI editor to the lighter Markdown syntax.

The Jekyll publishing process

You have a couple of options in terms of the markup you can use for your content in Jekyll. I decided to go with Markdown. It’s interchangeable with normal HTML and has some nice shortcuts for generating tags, etc.

The process for publishing a new post goes something like this:

  1. start Jekyll at the command line: jekyll --server --auto --permalink pretty This will start a local web server and allow you to see your changes by simply refreshing your browser.
  2. create a new file with some meta information at the top such as the title and the layout you would like to use.
  3. write your post’s content using your favorite text editor. At the moment I’m using TextMate which I’m pretty happy with since it has Markdown highlighting, etc. Along with Markdown, Jekyll provides a variety of data available to your pages via the Liquid markup.
  4. save, and wait for the HTML to be generated.
  5. upload the generated changes to any web server that is capable of serving static HTML.

Next steps

Although I’m just getting started with using Jekyll, the beauty is that you can make the process of writing as simple or as complicated as you want it to be. A couple of items I’m going to incorporate is adding Google custom search and possibly DISQUS to add commenting capability back.

Another option is to host all of your images, css, etc. on a CDN for even faster performance. I may use Amazon’s CloudFront service for this some time in the future.

Tags: #wordpress#jekyll#google#mysql#mac#tools