Blogger to Typo Migration
I’d been meaning to move my blog away from Blogger for a while and host it myself, and then I graded my old blog’s url with Website Grader. This found a few things wrong with my blog site (some of which were down to the blogger template), and it also pointed me to this article on HubSpot about why you shouldn’t use blogspot (or any other hosted blogging provider for that matter). This pushed me over the edge and persuaded me to actually go ahead and move.
The Swirrl blog is on Typo, and I’m happy enough with how it works, so I decided I was going to use the same engine for my personal blog. However, I wanted to import all of my old Blogger articles into my spanking new Typo installation but there was no easy way to do this (in fact this was one of the issues that HubSpot have with Blogger).
As you can see, I managed it in the end, and with this article I hope to make the process easier for those who want to follow in my footsteps! (These instructions assume a basic familiarity with rails).
1. Sign in to your blogger account, and make a back up of your current template.
2. If you aren’t already, make sure you’re using the ‘classic’ template (you might need to ‘revert’).
3. Follow these instructions from the blogger help pages for how to backup your blog, but with a few alterations:
1. Additionally set ‘Enable float alignment’ to ‘No’.
2. Instead of the template they suggest, use this:
<posts>
<Blogger>
<post>
<id><$BlogItemNumber$></id>
<title><$BlogItemTitle$></title>
<body><![CDATA[<$BlogItemBody$>]]></body>
<postedon><$BlogItemDateTime$></postedon>
<comments>
<BlogItemComments>
<comment>
<body><![CDATA[<$BlogCommentBody$>]]></body>
<postedon><$BlogCommentDateTime$></postedon>
<author><$BlogCommentAuthor$></author>
</comment>
</BlogItemComments>
</comments>
</post>
</Blogger>
</posts>3. When you publish your blogger blog with the temporary template, save it with an .xml extension.
4. You should now have an xml file that looks a bit like this: (make sure it’s a clean xml file with no other rubbish at the top).
<posts>
<post>
<id>115566100691553998</id>
<title>Hello</title>
<body><![CDATA[Hello! Rich here. Welcome to the Rich Text blog. In here you will find rants and musings mainly on computing and technology but other things may creep in too. Stay tuned.]]></body>
<postedon>8/15/2006 05:53:00 PM</postedon>
<comments>
</comments>
</post>
<!-- other posts here... -->
</posts>5. Download typo from the typosphere download page. Unpack it.
6. Go into the typo directory you’ve just created and make a database.yml configuration file.
7. Create the database structure with:
db:migrate8. From your typo directory start a server with:
script/server9. In a browser, go to your typo site’s admin section (e.g. http://localhost:3001/admin) and sign up.
10. Have a look in the database and make a note of the user id of the user you just created.
11. Download my blogger to typo converter script. (This is based on a script I found on Jonas Bengtsson’s blog, with a few tweaks – Thanks Jonas!).
12. Run that script. (run ruby blogger.rb -h for usage). For example, the following will import the contents of ~/Desktop/blogger_export.xml (excluding blogger labels), under auhor ‘Ric’ (id 1), using the environment settings in ~/Documents/typo-5.0.3/config/environment:
ruby blogger.rb -l --author Ric --authorid 1 --files ~/Desktop/blogger_export.xml --envpath ~/Documents/typo-5.0.3/config/environment
13. Log back into your typo blog’s admin section and sort out your layouts, and delete the default Typo posts.
Phew! That’s it. You should now have all of your blogger posts in your new Typo installation.
Please be careful and make sure you take backups of anything important – I make no guarantees about my script. It was hacked together quickly to do the job in hand. Happy migrating…
I co-founded, built, and run




