WordPress is great, but with all of the features they have added over the years, it has started to become a little much for a small blog of a few pages. I recently decided to switch my site from WordPress to the static site generator, Jekyll, to cut down my worries about required updates and comment spam, improve site performance, and make my life a little easier.

Getting Started

Getting started is easy. If you haven’t already installed Jekyll, it’s a simple:

gem install jekyll

Then, just create a new Jekyll site.

jekyll new blog

We’re rocking and rolling.

Exporting Content

The Jekyll site links to a command line content migrator that requires you to enter your database credentials, etc. to export your content. That seemed like a lot of work considering how few posts I have. Instead, I found a WordPress plugin, Jekyll Exporter that nicely exports all your posts and pages into markdown files. It even pulls out your images into the wp-content directory and tries to configure your URLs properly.

The plugin creates a zip file. You simply download the zip file, unzip it, and copy the contents into your Jekyll project.

Configuration

You’ll want to make a couple of changes to your _config.yml file. I added my .htaccess file to the list of includes because Jekyll ignores dot files by default. I added gulp-related files and directories to exclude. If you forget to do this, it can take a long time to regenerate your site. Finally, you’ll want to set up your permalinks to match your WordPress config so you don’t break your old URLs. The pretty setting worked for me, but all of your options are listed in Jekyll doc.

exclude: [node_modules, gulpfile.js, package.json]
include: [.htaccess]
permalink: pretty

If you’re using HTMLHint, you’ll want to turn off the requirement to have a doctype on line 1. You’ll need to add this to your .htmlhintrc (or create one):

{
    "doctype-first": false
}

Layout

I’m still using the default layout for my blog. I plan on updating that in the near future. Doing layout in Jekyll is easier than in WordPress.

I also easily added my new one off design home page to the project. That involved nothing more than copying the index.html file and all of its assets into the Jekyll project and adding empty Yaml front matter to my Sass files so that Jekyll will process it.

Build Process

One reason for switching over to Jekyll was so that I could take advantage of a build process to minify files and prepare for deployment.

Sass is already built into Jekyll. To compress your output, just add this to your _config.yml file:

sass:
    style: compressed

There may be plugins available for minifying HTML and JavaScript, but the plugin listed on the Jekyll site is no longer supported. So, I’m using Gulp to do this. It seems like the right choice since I’m also planning on setting up Gulp to deploy my site.

Deploying

For now, I’m just using Transmit to upload the new files when I make a change. That’s a little more work than just hitting the Post button.

However, my plan is to incorporate deployment into my build process so that it will be as simple as

gulp build
gulp deploy

First I need to set up the deploy process to use incremental building and only upload files changed since the last build.

Saying Goodbye to WordPress

Once my site was ready to go, the last thing I had to do was say goodbye to WordPress.

First, I logged into CPanel and deleted the WordPress database.

Next, I deleted all of the WordPress .php files and directories from my server.

Finally, I replaced the .htaccess file so that the server would not try to route everything through index.php.

Painless.

Conclusion

So, this turned into a bit of a process to set it up just how I wanted. However, I expect to save a lot in long term maintenance. I was prompted to finish up this project when I was hit with a barrage of comment spam the other day. Those days are long gone.