Migrating from Octopress to WordPress

February 26, 2014

I’ve recently migrated from Octopress to WordPress (yep, you read that right). I moved over to Octopress when it first became popular a few years ago, but it has started to get a bit limited for my needs. I want something more like a CMS, which WordPress handles quite well. Unfortunately migrating wasn’t so straight forward, here is what I did.

1. Export posts from Octopress

I found an old Python script which was supposed to use the WordPress XML-RPC to import the posts, however I couldn’t get it to work. For some reason posts were missing titles, so I gave up on that. WordPress has the idea of ‘Importers’ built in, and one of those is RSS. Octopress doesn’t support RSS though 🙂 I found a script which added support, and modified it a bit to export all the posts, not just the twenty latest.

Put that in source/rss.xml, and run jekyll generate. Your RSS file will then be in public/rss.xml.

2. Import posts into WordPress

The next step is easy. In WordPress go to Tools  -> Import, and select RSS. You will be prompted to install the importer if you don’t have it already. Then select the RSS file generated in step one.

Caveats

Unfortunately not everything worked as planned. Pictures and file uploads were the main issues, as the URLs in the post content weren’t changed. I found and forked a plugin called Auto Save Remote Images. The original version only saved the first image, and saving didn’t actually work for me. I couldn’t figure out why saving wouldn’t work (it was just calling a native WordPress function), so I removed that functionality and just had it update the URL in the post. Fortunately Octopress and WordPress store files in the same directory structure, so it was a simple case of copying the files across.