PhpRiot
Follow phpriot on Twitter
Sponsored Link
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Migrating from ExpressionEngine to Jekyll

Note: This article was originally published at Planet PHP on 2 April 2011.
Planet PHP

I've run Funkatron.com on ExpressionEngine for a long time. It's a strong, flexible, powerful CMS that I recommend to many folks who need to build content-driven sites, especially those where the site will be administered by non-programmers. It's a very solid choice for consultants and freelancers, who can build the relatively small license cost into their fees - and probably save the client in the long run.

However, over the years, I've found ExpressionEngine to be overkill for a blog site. If you're only maintaining one or two types of content (like blog posts and links), the overhead involved in maintaining the system becomes unwieldy. I've long put off upgrading to EE2 because I dreaded having to convert my templates, find replacements for incompatible addons, and finding all the little bugs that seem to pop up in a major version upgrade.

Jekyll is quite the opposite of a system like ExpressionEngine. It's entirely command-line driven, so you have to be comfortable with the shell and some scripting. It's really aimed at web programmers who want a simple tool to publish a blog, without worrying about all the overhead of databases, web-based administration, and a monster code base. You have very fine-grained control over how everything works.

The simplicity of Jekyll has been appealing to me since I encountered it when messing around with the GitHub Pages feature. I never ended up doing a lot with GitHub Pages, but the idea of a simple, script-driven blog generator has continued to be very appealing to me.

A few weeks ago, I decided I either needed to bite the bullet and either upgrade to EE2, or switch to another system. I decided to do the latter, and give Jekyll a shot.

This post won't go into every detail about running a Jekyll site. You should definitely read the docs and get familiar with how it works. I'll just be covering issues of note particular to my move from EE to Jekyll. I also encourage you to check out my GitHub repo for funkatron.com, which contains almost everything I use for my Jekyll site.

Exporting posts

The biggest challenge was sorting out how to get the data out of ExpressionEngine. Each entry in my blog a€owebloga€¯ (an EE term for a collection of a content type) consisted of these fields:

  • title
  • date
  • author
  • categories
  • slug
  • summary - rarely used
  • post body
  • post body format - a formatter that is applied on output, so you can write posts in textile of markdown and they come out as html
  • extended text - rarely used
  • keywords/tags - comma-separated

From that, I needed to get my posts into flat files, consisting of some Yaml at the top, and the post content underneath.

The typical approach for exporting data from an existing system is to directly query the DB, but this is a bit more complex with EE. EE has a very, very complex schema that's basically a case study in why RDBMSes are not suitable for flexible content storage. So yeah, I could dive into that monster, but I was not excited about doing it.

Thankfully, a little Googlin' turned up a much more sensible solution: Just use EE itself to generate a dump file. Because you can generate just about any kind of content format with EE's templates, you can let the CMS itself do the dirty work of pulling the post content together, and format it as needed.

I basically followed the approach Robin Fay suggests in her blog. She's dumping data out to import into Movable Type, though, so I had to do things a little differently.

  1. I made a template group in ExpressionEngine called exp

  2. I created a template in the exp group called comments. Yes, this will output the comments as html. More on that later.

  3. I created a template in the exp group called posts_jekyll. Here I am generating the Yaml a€ofront mattera€¯ to include some required stuff (like layout and

Truncated by Planet PHP, read more at the original (another 8959 bytes)