Migrating from Wordpress to Jekyll in ten steps

Migrating from Wordpress to Jekyll is not at all a fussy process. Here, I will state down the 10 steps on how I moved my blog from Wordpress to github pages using jekyll. It would be really good if you could just have a walk through jekyll's home pages to get an idea of the prerequisities and workings.

1) Export your blog from Wordpress and download the exported xml thats generated by Wordpress. Use xmllint for xml validation and correct any errors that might be there.

2) Jekyll provides with enough options to migrate from a different blogging system. What I used for the process was the tool, exitwp by thomasf. Followed the instructions in the README and this worked like a charm .

If followed properly, the build directory will have the posts converted into markdown format which is required by jekyll.

3) Install the jekyll gem,

$: gem install jekyll

4) Now initialize your new blog

$: jekyll new techblog

cd into the techblog directory and you could see the directory structure there.

_posts  
_layouts  
css  
_config.yml  
index.html  

This is the minimum directory structure that jenkyll requires inorder to work as a fully functional website. How cool, right?
Now all you need is to copy all the posts from the build/jekyll/username.wordpress.com/_posts directory of the exitwp tool to the _posts directory of your new techblog. Also you may want to add your own configurations in the config file (specially, the permalink option)

5) Once you have done this, its time to view the website in our local machine. To do this run,

$: jekyll serve -w   # -w, watch so that your changes are automatically reloaded

http://localhost:4000 and you could view your minimalistic static website.

6) Now to host your website on github pages, there are some special rules to be followed. The repo you create in github must be of the name, username.github.io and there fore in my case it was sunilkumarn.github.io . Create this repo in your github account and set the giturl in your local techblog directory.

7) Push your commits to github.

8) Check your mail to see if there are any build failure mails from github. If no, all is hunky dorry. Wait for something like 5 -10 minutes and type http://username.github.io in your browser. You should see your website, Yeeyy!

9) To point a domain to your website, check github pages help. For me, I pointed a subdomain to my new blog.

  • Github pages will mention the IP hosted. Point the A record of your domain to the mentioned IP from your domain registrar.

  • Also, add a new file CNAME to the root of your techblog directory. The file has a line containing your domain name, thats it. eg, tech.sunilnkumar.com

10) Push your changes to github and wait for some time (cannot provide a good estimate). Your domain will be pointed to your new website hosted on github pages via jekyll. Also please do not forget to check if issues like broken urls, formatting issues, code highlightings etc etc exists. If yes, you might need to invest a bit more of your time to fix these as I had to.

The source of my website can be found here

Happy migrating :)