Migrating from Wordpress to Nikola

  1. Export XML dump of Wordpress files
  2. Use nikola import_wordpress to import each blog entry in the wordpress XML file into a markdown file with a metadata header about the post.

Run the command nikola import_wordpress

[stephen@macbook.local] Thu Jun 09 ~/Downloads/stephenhucker.com
[17] 17:18:23--> nikola import_wordpress --one-file posts.xml -o out
[2016-06-09T07:19:49Z] WARNING: import_wordpress: You specified additional arguments (['out']). Please consider putting these arguments before the filename if you are running into problems.
ERROR: Error parsing Command: option -o not recognized (parsing options: ['-q', '-o'])
[2016-06-09T07:19:51Z] INFO: Nikola: Configuration will be written to: -o/conf.py

I obviously got some of the command syntax wrong, but I don't care because it did what I wanted.

The --one-file option is important. If you don't use it, then you will get two files for each blog post. One with markdown of the posts content and the other contains the metadata about the post.

anyong-hello-kitty.md

anyong-hello-kitty.meta

Metadata header made from wordpress blog entry

<!-- 
.. title: anyong hello Kitty
.. slug: anyong-hello-kitty
.. date: 2006-01-29 04:16:20
.. tags: 
.. category: 
.. link: 
.. description: 
.. type: text
.. wp-status: publish
-->

BODY OF WORDPRESS POST - Very often the body of the post will contain HTML elements b/c wordpress formatting can be a bit of a mess and this is the easiest way to extract the body of the post with its formatting.

<html><body><p>The ultimate example of Korean and Japanese cultural cooperation.

<img alt="Korean Hello Kitty" title="Korean Hello Kitty" src="http://static.flickr.com/30/89653293_99d7f40a8c.jpg"></p></body></html>