WordPress to Jekyll (or how I learned to love markdown) - Part 2
Last time I talked about why I moved my blog to Jekyll from WordPress and the initial set up process. After the break I’ll explain how I kept all my precious posts from the old blog
Luckily wordpress.com provides a means to export all posts from a blog to an XML document. A pretty nice feature for a free hosted blog don’t you think? All you need to do is login to the blog control panel, click on tools > export and then click export again.
WordPress.com XML export
At this point you’ll now have an XML document containing all the post content and a folder full of any images from the blog. You’ll of course wonder how to get this into Jekyll.
Well the lovely people of the internet have written such a tool, first you need to install the Jekyll Import gem like so:
gem install jekyll-import
Then head on over to the import documentation for a guide on how to import the XML. But the command should be similar to the following:
ruby -rubygems -e 'require "jekyll-import";
JekyllImport::Importers::WordpressDotCom.run({
"source" => "wordpress.xml",
"no_fetch_images" => false,
"assets_folder" => "assets"
})'
This will in essence parse over the XML document and create a series of markdown files based on the content. At this point I would advise looking over the created markdown files and check the formatting etc. Mine were readable but a little messed up on a few links and images.
Regarding this blog specifically, I have used the Poole framework as a starting point (specifically the Lanyon theme). I did this as it provides a really good set of default templates and what I believe to be a clean and nice looking UI. Of course I have made a few changes; font family/size, headers etc to match my own website but nothing massive.
The final change I have made is the related posts feature seen at the bottom of each post. Jekyll does have a related posts feature built in, but support is flakey at best. So I have taken the advice of Chris Yin on this post: http://www.chrisyin.com/2014/08/23/jekyll-related-posts/. Follow his instructions to create a new plugin and layout which will allow Jekyll to create related posts based on your markdown files front matter.
Thats about it for now. Cheers.