January 26, 2015
Migration from Wordpress

Finally made the move.

This site as you see now is hosted on Amazon S3, statically. It is always reachable, and no spike is going to bring it down. In short, one less thing to worry.

Google will show dozens of how-tos on Wordpress migration. Any way let's document the process. One more success story doesn't hurt.

The Migration

1) Convert Wordpress exported xml file into markdown formats. We use the tool wp4md. The output is a folder containing pages and posts. Every markdown file has tags in beginning, including critical information like the original link, created date. They are very easy to parse.

wp4md -d myblog  <wordpress-dump.xml>

2) It's up to you to convert those markdown files into html. Everyone has unique taste, and it shouldn't be hard to build customized one, given so many powerful script languages and packages.

3) Register a Disqus account. We are not going into details, but basically what you need to do is:

  1. Import that same xml dump;
  2. Provide a csv file to map old urls to new urls. This could be done programatically using the tags in markdown files. When you're done, upload that file to the Disqus website.

4) Redirect the old links. You don't want Google search results pointing to an unusable link, so you need to map those old links to new locations. Normally you should do that with a web server like nginx, but we are now on a static host. It may be possible to use redirect rules provided by Amazon S3, however, I don't really have the time to learn those rules, when we could simply do it with javascript.

Suppose a page was at


Now it's changed to


Then in index.html, we only need to do a check:

var urlmap = {
var pathQuery = window.location.pathname + window.location.search;
if (urlmap[pathQuery]) {
    window.location = urlmap[pathQuery];

That's it.