Prashanth Babu

Ramblings on Hadoop Ecosytem, Java, etc.

Migrating from Blogger to Octopress

So like many others in the blogging world, I too shifted from Blogger to statically generated Octopress hosted on GitHub last week.And today I completed migrating all my Blogger posts to Octopress and got them hosted here. Henceforth will leave Blogger as-is and will try to make this as my active blog.

Initially I was kinda apprehensive that I might have to put in significant effort to migrate my posts from Blogger to Octopress. But it turned out to be very simple actually. In fact, it was as simple as running just a single Ruby script.

I have listed below the required steps for migration, just in case if someone needs a ready reference.

  • Export your content from Blogger:
    • Go to Blogger Settings -> Other -> Blog Tools -> Click on “Export blog” link.
    • This screenshot might be helpful for reaching this section in Blogger maze.
    • This downloads an xml file [in the format blog-month-date-year.xml] with all the content from your blogs. In my case, it turned out to be “blog-01-18-2015.xml”.
  • Ruby script for migration:
    • Then get a copy of a Ruby script from this Gist for converting posts from Blogger format to Octopress compatible format.
    • Please remember you might need to have nokogiri gem - if not already installed - before moving further. Command to install this gem is: gem install nokogiri.
  • Execution of Ruby script:
    • Run this Ruby script on the xml file you downloaded above. Command for execution is: ruby import.rb blog-01-18-2015.xml.
    • This generates the content of your blog in html files.
    • During the migration, this script tries to retain the exact same path you would have used in the Blogger script and also tries to get the date [but not time] of the post and categories, etc you would have listed for each of your posts in Blogger. Very neat I would say.
  • Post generation of posts:
    • Copy the generated html files to _source/posts folder in your Octopress folder and you are done.
    • Do a rake generate and rake preview and check the blog posts have all come well and confirm if the migration went fine.
    • Once you are happy with the migration and content, perform rake deploy.
    • And don’t forget to push these changes to GitHub.
  • Few caveats:
    • Please note that all the files usually crated by rake tasks are .md i.e. markdown files while the migrated scripts will be plain html files.
    • Also please note that post the migration, all the migrated posts will retain the correct date, but time gets defaulted to 12:00 AM. I could not find time to debug the issue though.

Hope these steps were useful to you. Enjoy the new blog and glory!