We have moved

mobile home by Dave Young is licended under CC BY 2.0 - cropped to fit ratio

Ever since 20041 that I’ve used WordPress as my blogging platform and while I’ve done little to no development on it, it’s been nice to witness the evolution and all the new things each version brought along - from the general interface, the editor and even the built-in template - it really has come a long way.

It also suffered the fate of both fame and it’s legacy codebase, in it that you will always get much more than you need, tailoring things to your needs may add a lot of dependencies that might not survive upgrades and there’s an ongoing battle for safety that you mostly lost already, unless you can very diligently keep everything up to that and provided you close all the less obvious doors you can.

On top of that performance hasn’t been great and in fact, for the past months given the low limits on memory usage and process execution time on Dreamhost’s shared servers, it was actually so bad more than half of the requests wouldn’t even be served, it’s a blog for , it’s madness that performance could ever be an issue, and apart from some house cleaning and removing of non essencial plugins2 I really couldn’t be spending a lot of time investigating modern mysteries, not for this at least.

Going back to Web 1.0

A blog is 99% reads and %13 write, so having an entire application on the ready all of the time making DB lookups and rendering pages all the time is clearly a waste of resources, and given it wasn’t even doing that very well, so goig back to Ye Olde Ways of having static HTML files lying around seems, in this light, a good strategy.

Of course, partying like it’s 1999 isn’t really the intention here, so I looked around to modern tools to help me.

Enter Jekyll

Jekyll is nothing more than a machine that chews content alongside some templates and spits HTML on the other end4, it’s written in Ruby and development is pretty active5, so I decided to invest a bit on that track.

Migrating content

The first thing that I absolutely needed to get done was migrating the data from my WordPress blog and luckily I didn’t had to search for long as Jekyll offers support for that.

I initially tried importing directly from the database but that didn’t work so well, for one I had way too much content since one particular plugin - that in the meantime I removed - (ab)used the post table and I had some encoding issues, which were easy enough to fix, but hey why bother given I had a second option. WordPress let’s you export your content in an XML file and Jekyll also supports this. Running re-created all my posts in the form of individual HTML files, with all the metadata that WordPress might add included in a YAML block on each post.

There was - and will be - a bit of cleaning up, as a few plugins or WordPress features include special markup on the code and of course Jekyll won’t know what to do with that except blatantly exporting it to the final HTML. Some things were as easy as doing a globals search and replace, others need to be individually addressed, but overall, the process is relatively smooth.

Theme

Of course, I had no illusions about having a drop-in replacement for the theme that I was using on my WordPress blog, but I had accepted that long ago and decided to write my own, which due to my amazingly limited design skills and general good taste, was meant to be as simple as possible, in other words, I might actually be able to do it.

By the same token, I wanted to move away from the default web framework and try something else, so I turned to Ink and with a great deal of pride for the work people I personally know and worked with, it turned out to be super easy to slap something together, responsive and built-in image size optimization for different devices alongside other niceties.

I wanted to keep it simple, but with something to look at6, so I settled for a grid made up of the last posts with an optional header image, and this was stretching my skills up to 11.

The twentyfourteen theme applied to the previous blog
the new theme applied to jekyll

Plugins

Of course, Jekyll has a bunch of plugins that you can use to either provide more tags, generate special pages or similar, I installed a few ones, namely:

  • jekyll-import - As stated before, this helps with the migrating of content from other platforms
  • jekyll-sitemap - Generates a sitemap.xml file from all the posts / pages you have.
  • jekyll-oembed - Provides a oembed tag that fetches the necessary markup to embed (sic) videos and other external resources. This helped migrate some of the older posts.
  • jekyll-assets - Basically adds the Rails asset pipeline into Jenkins, so you get all your CSS / JS fingerprinted and passed on through compressors. Be sure to read this for help setting things up.

Deployment

For deployment I went for a simple approach of having a script that builds the site and uses rsync to update the files on the server, it’s as easy as that

#!/usr/bin/env bash
jekyll build --config _config.production.yml \
  && rsync -avz --delete \
  _site/ your_user@your_server:your_path

The reason why I have a separate configuration file is that I want to specify certain paths for assets and base urls differently from my development environment.

Further customizations / notes

There’s not a lot more note worthy, except a few links that might get you going in terms of having Twitter / Facebook / etc friendly metadata, these two links will give you a leg up.

I also created a few templates to handle stuff like post excerpts and the header image - and CC attribution - taking advantage of the metadata I can add into each post. It’s all basic stuff and it’s nice that Jekyll is so nice about it.

What did I left out?

Well, of course some of the work that the WordPress editor did, especially in terms of media, will now be a more manual process, but to be honest, that’s ok, as I’ll end up having a more methodical approach instead of just dropping files into the web interface - which I already regret as I look at the crazyness of my images folder. I will stick to Google Analytics for reports now - yes, I want to improve my 1 req/week - where before the WordPress graph was nice enough.

What I haven’t done any work on is bring in comments support, for years now I’ve been using Disqus and since I have all the metadata in the post, including Disqus thread_id, it should be straightforward enough bringing those in, and link the old ones to the right post, but to be completely honest, I don’t think I want to. Hardly anyone commented anyway, and I think I rather push for discussion on social networks - or GOD FORBID ACTUALLY EMAILING ME - than keep that infrastructure going.

I also took the time to move to the root ragingnexus.com domain instead of using the david.ragingnexus.com subdomain, it probably makes more sense this way, so I’ll took the opportunity to do that. Of course that means I have to setup redirects on the old blog, but I’ll test this one for a while before pulling the plug on the other one and migrate traffic over here.

In conclusion

I’m very happy with the way it all went so far, I’ll annoy far more talented people in the next few days to try and improve the theme, and I’ll eventually shutdown the old blog and point everything here, but the overall experience has been very smooth, both with Jekyll and with Ink and if this sort of setup makes sense to you, I highly recommend you going forward with it, there are enough tools to make this a relatively straighforwar experience.

Comments, tips, suggestions are super welcome, tweet me something :P


  1. Short and meaningless, as all (?) first posts go 

  2. By essential I mean either some very specific functionality that was more than nice to have or security related plugins (sic). Jetpack has been growing in awesomeness, it’s very likely it’s been getting fat as well :) 

  3. I’m exaggerating of course, for me it’s more 99.99% read and 0.01% write 

  4. Don’t think to hard of this analogy please 

  5. Wink wink Github Pages is supported by Jekyll 

  6. I would hate for you to have to read through anything, so pictures will do