Migrating Wordpress to Octopress is no easy task, it took a lot of thought, time & planning but the end result has been well worth it. I now have a fast (static), secure blog without the performance issues experienced with a CMS running on a LAMP stack.
Why I Migrated from Wordpress to Octopress
Here is a list of reasons I moved from Wordpress to Octopress:
- Performance (my little VPS can take 1000s of concurrent page views, wordpress could take about 50)
- Security, there is no PHP or MySQL injection / Wordpress plugins exploits to compromise
- No more Wordpress updates \o/
- No more installing Wordpress plugins to get the functionality I need
- No more Wordpress HTML / WYSIWYG editor!
- I can now create my blog posts in Vi
I would like to point out that I do like Wordpress, it’s a great web app it uses a lot of resources but has most on page aspects of SEO nailed out of the box (well ok you might need a few plugins) but it still the app I would recommend to non hackers.
Step 1 Export Wordpress Posts to markdown
- Login to Wordpress and Export your Posts to XML
- Download exitwp, clone the git repository & read the getting started instructions
This should rather rapidly convert your wp posts to markdown (the format Octopress needs), note that if you are using fedora 17 you can install all of the required deps via yum (deps are listed in the README file).
Issues with exitwp
I had to go through every single .markdown file it exported and check for dodgy formatting, incorrect usage of quotes and missing meta descriptions… This took a long time.
Step 2 Install Octopress
Follow the instructions to install Octopress, note that on Fedora 17 I installed Ruby 1.9.3 with yum:
1
|
|
After that I followed the documentation to complete the install, for deployment I used rsync as I wanted to host my own blog not use github. Note this will require setting up SSH keys (unless you want to auth via password each time you deploy), I recommend you follow the rsync deployment page.
Once you are done, open up _config.yml and update the file with your blog name, meta data & twitter handle etc (it’s fairly self-explanatory).
Step 3 Import markdown Posts
Next I imported the freshly created .markdown files into the directory /octopress/source/_posts/, I imported a few at a time and then generated the blog using:
1
|
|
Make sure there are no errors and that the public dir is now populated with your articles (this is the dir that gets rsync’d / pushed to your server or git repo).
If you get a syntax error then you will have to go through each file and check the markdown syntax for each file, this is often caused by the lack of a white space after the : at the top of the file or the lack of / incorrect use of quotes (title must be wrapped in quotes).
Try not to give up at this stage, it’s just the initial migration that’s painful to get converted to Octopress.
Generate & Deploy Octopress
To generate your blog enter the following from the octopress directory:
1
|
|
Check for errors and the deploy with:
1
|
|
Your site should new be view-able at your URL.
I ran into a few syntax errors that have little online documentation (I found something in Chinese! that I had to make sense of!), I am going to make a seperate post for Octopress errors & troubleshooting.
Comments (bit of a Snafu)
There is no comment system for Octopress, at first I thought I’d do away with comments as i’v had enough of comment spammers. However I reconsidered due to the amount of people helped via comments. Octopress uses DISQUS for comments and I was not thrilled about using a 3rd party but sometimes it’s just the best option and after reading DISQUS they do promise that their commenting service will always be free… And it seems to work well so far.
Importing Comments from Wordpress to DISQUS
This was painless:
- Login to the old wordpress blog, install the DISQUS wp plugin
- Enter your username and password for DISQUS
- Click the “Export Existing Comments now” link and you are done
To enable DISQUS on Octopress just add your username to the DISQUS section in _config.yml then Generate & Deploy your site again, just so long your URL’s are the same you should see your old WP blog comments on your new Octopress blog.