Monday, November 5, 2012

Moving blogs from Blogger to Sitefinity

Currently, I’m quite happy with blogger.com as a blogging platform. But I can imagine that at a given time I would like to move my blog to more sophisticated content managements system. My choice would be of course Sitefinity, since I’m quite familiar with it (and it’s .NET). One of the main problems then would be to move my existing content from one platform to another. That’s why, I decided it will be a nice idea to write a Sitefinity module that does this.
Luckily, Blogger.com gives you the option to export all the content in a single xml file (in atom publishing format). So, half of the work is already done, you just need to import this content to your Sitefinity project. Using Sitefinity Thunder, I created a new Sitefinity Module (called eTabakov.Sitefinity.Modules.BlogsImport) and setup a backend page with a new widget in it. The widget just takes a file from a users PC. Then I have an interface IBlogsMigrationProvider:

It simply takes a Stream and tries to migrate the content in it to a Blog in Sitefinity. This way we can easily add additional blog platforms (Wordpress for example). Right now, I have only one imeplementation of this interface BloggerMigrationProvder:

It currently migrates all the blog posts together with their comments and tags ( and create new tags, if such doesn’t exist). In order to extract the information from the xml file, I decided to use XmlSerializer – that’s why there is a folder in the module called DataObjects that has a class for every xml element from the document that I need:


The whole project is published on github.com, so you can download the source and use the module to migrate your Blogger.com account. You are more than welcome to contribute to the project or just take a look around. https://github.com/etabakov/etabakov.Sitefinity.Modules.BlogsImport
Any comments are more than welcome, too!