Kushal Das

FOSS and life. Kushal Das talks here.


Importing your Wordpress blog to Nikola

title: Move from Wordpress ...

So you want to import from blog from Wordpress to Nikola ? This post will tell you the steps required.

Install Nikola

First step is to install the latest Nikola. :

$ pip install https://github.com/ralsina/nikola/zipball/master

Export your Wordpress blog

Next step is to export your existing blog into XML format. Login to your Wordpress, then goto Dashboard->Tools->Export option and download the exported xml file to your computer, the name of the file will be like mysite.wordpress.2012-12-20.xml

Remember to update your Wordpress to the latest version before exporting.

Import the blogs

You can import the posts using the following command :

$ nikola import_wordpress mysite.wordpress.2012-12-20.xml

After the above command you will have a new_site directory and inside your blog is ready.

This import will have:

  • All your posts and pages
  • Keeps "draft" status
  • Your tags and categories
  • Imports your attachments and fixes links to point to the right places
  • Will try to add redirects that send the old post URLs to the new ones
  • Will give you a url_map so you know where each old post was, you can also use this file in Disqus to map comments.

If you get errors while importing the xml file, please do mail the xml file to the upstream so that he can fix the importer.

Building the site

You can build the posts using the following command inside the new_site directory. :

$ nikola build

Uploading the posts to your site

You can just rsync output/* to your site and it will be available to others. You can have deploy command for the same in conf.py :

'rsync -rav --delete output/* kushal@fedorapeople.org:./public_html/',

Uploading your blog/site as github pages

You can use the same files to create your github pages. You just need to put output directory under git as username.github.com git repo.

The naming schema must have username/username.github.com naming scheme.

After this username.github.com should be ready.

Uploading your blog/site as bitbucket pages

If you want to use BitBucket to host your static site, do the following.

  • Create a repository named yourusername.bitbucket.org on BitBucket.
  • Added output/* into the repo and push it to bitbucket.

After this username.bitbucket.org should be ready.