moving to octopress

Fri, Jun 7, 2013

I've been playing around with Octopress as I like the idea of a static site and writing everything in markdown, so I had a read and came up with a way to convert my Wordpress blog to an Octopress static blog site.

The first attempt was via a Wordpress plugin that seems the best way to do it. It runs everything though the Wordpress engine so you get all the plugins doing their work to output their relevant HTML. It then zips the whole lot up but it didn't work on my blog. So next up was visiting the Jekyll migrations site and the jekyll-import gem worked first time. Apparently it doesn't do some metadata so the final one I tried was exitwp.

First I needed to clone exitwp from github:

git clone https://github.com/thomasf/exitwp.git

cd exitwp

Then export my Wordpress blog as an XML file and put it in the correct directory:

cp codebraneblog.wordpress.2013-06-07.xml wordress_xml

Next I ran xmllint on it:

xmllint wordpress-xml/codebraneblog.wordpress.2013-06-07.xml

fixed any errors (usually encoding stuff)

then added the necessary python libraries:

sudo python -m easy_install pyyaml
sudo python -m easy_install BeautifulSoup4

and finally, ran the conversion:

python exitwp.py

and my new Octopress posts and pages were in:

build/jekyll/codebrane.comblog

I then had a problem with the Wordpress gist plugin. Rather than seeing the actual gists, I just saw the gist id="blah" tag, which is what I was expecting as exitwp just works on the export and Wordpress doesn't run everything through its engine before exporting. The fix was easy though, just go through all the posts regexing the gists:

and voila, one Octopress blog!

 

comments powered by Disqus