I’ve been super annoyed with WordPress for a variety of reasons. The editor is kind of slow. The admin interface is overkill for what I need, and also it costs money, and like all programmers with just a miniscule amount of free-time we will burn countless hours cobbling together scripts and obscure frameworks to save myself $45 a year or whatever it is I was paying for WordPress hosting. Most of all I was annoyed at not having a lot of control over the visual appearance of my blog on WordPress combined with little motivation to learn how to configure plugins and customize themes on the platform. I will say that developers that specialize in WordPress are brilliant mad-scientists who can literally make blood drip from a stone.
But I am not one of those. So I decided to migrate to a programmer-friendly framework: Jekyll.
If you search the internet for “migrate from wordpress to jekyll” a lot of the first links you will find are for installing a plugin on WordPress called Jekyll Exporter. I have never actually used a plugin and figured I’d give it a try, but unfortunately, only being subscribed to the WordPres basic plan, I was not allowed to install plugins, a feature reserved for business plan holders. Seemed kind of silly to upgrade my plan, when the whole point of this sordid operation is to migrate my blog away from WordPress.
First I exported my site content to an XML file using the WordPress administrative interface and downloaded it locally. After that I ran a script to transform the exported WordPress XMLI found on GitHub which outputs a Jekyll-friendly
_posts directory. Success!
NOTE: Although draft posts are part of the WordPress export file, the above-mentioned script, wordpress2jekyll.rb, will ignore those during the process of converting posts to markdown files. If you have a lot of drafts to convert, you might want to modify the script, or simply add an arbitrary publish date
<pubDate>..</pubDate> to the posts inside of the XML file prior to running the conversion script. Just test that adding.
TODO: A) Verify the above works, and B) maybe fork the script so it’s permanently available
Well, it’s almost a success. Depending on the variety of content you had in your original WordPress blog, you might have to do some manual cleanup at this point to really dial things in. If your WordPress site was just blog, the export function will dump EVERYTHING into the XML file, which might include some fixed content such (eg. an
About page), and other such things. Also the converted markdown posts might need some additional cleanup, for example you might find tags like the following in the converted markdown posts.
SImilarly, if you used tables, or other types of formatting mechanisms, you’ll seem some residual wordpresss tags that need to be removed, or fixed after converting to markdown posts.
As far as I can tell, you’ll just need to remove those manually.
The last issue is that any images embedded in your blog posts will remain hosted on WordPress, and the converted blog post markdown files will continue to maintain links to those images as if they will continue to be hosted on WordPress.