Migrating Wordpress to Nikola
Posted: | More posts about Nikola Python Wordpress Content Management
This is by no means an exhaustive Wordpress to Nikola migration guide but it should provide enough clues for anyone else wanting to do the same. The following was done on Ubuntu 10.04 LTS.
Export the Wordpress content.
Tools -> Export -> All Content
xmllint to find any errors in the Wordpress XML export and fix them.
UPDATE! I've added the instructions for install Nikola 5 since fist publishing this post.
Install Nikola 5 in a
cd ~ sudo apt-get install libxslt1-dev libxml2-dev libjpeg62-dev python2.6-dev wget http://nikola-generator.googlecode.com/files/nikola-5.zip unzip ~/nikola-5.zip mkvirtualenv -i markdown -r ~/nikola-5/requirements.txt --use-distribute nikola-5 cd ~/nikola-5 python setup.py install
Install Nikola 4.0.3, in a
Nikola 4.0.3 spits deprecation warnings with
doit>=0.16.1 hence the use of
cd ~ sudo apt-get install libxslt1-dev libxml2-dev libjpeg62-dev python2.6-dev wget http://nikola-generator.googlecode.com/files/nikola-4.0.3.zip unzip ~/nikola-4.0.3.zip sed -i 's/>=0\.16/==0\.16/' ~/nikola-4.0.3/requirements.txt mkvirtualenv -i markdown -r ~/nikola-4.0.3/requirements.txt --use-distribute nikola cd nikola-4.0.3 python setup.py install
Import the Wordpress content.
cd nikola import_wordpress wordpress.linted.xml
Use html2text to convert the HTML
new_site/posts/*.wp to real Markdown.
If required, generate a list of the Wordpress URLs for Nikola redirections.
grep "<link>" wordpress.linted.xml | sed -e 's/<link>//g' -e 's/<\/link>//g'
I migrated from several sub-domains to one top-level and the Wordpress URLs I was using can't be presevered with Nikola. I use a combination of Nikola redirects and nginx configuration to handle the redirections.
At this point the bulk of the migration is done. I tweaked the Nikola
.md files instead of
.wp, added some assets to the Nikola
directory, configured deployments and updated the theme. I also decided to axe
some obsolete blog posts.
Migrating to Disqus has been very frustrating and although my comments have now been migrated the Migrate Threads has yet reflect the new URLs of my posts. There is no visibility of what, if anything, is happening when you execute the Disqus URL Mapper. This is not a Nikola issue.
I am extremely happy with Nikola itself and it has proved itself flexible and I can now capture my notes in a familiar format and in a familiar environment, Python. Next steps are to integrate Nikola with Dropbox so I can publish from any device with ease and add a search facility.