Philipp Küng

Guy behind @bitfondue

Migrate from BlogEngine.NET to Jekyll

This is the second part of steps you have to take in order to migrate smoothly over to Jekyll, Octopress in my case, coming from BlogEngine land. I’d recommend you first have a look at moving your comments to disqus, before following this post.

##Getting the “old data”

Log into your BlogEngine site and head over to Settings where you click on the Export button for BlogML. Now FTP or SSH into your server and get a complete dump of the App_Data/files folder onto your local machine.

##Setup Octopress

Octopress? - Isn’t this tutorial for Jekyll? - you might ask. Well Octopress is built on top of Jekyll and brings some plugins and clever defaults to make your life easier. Start off by following the official Octopress Setup tutorial. If your working on an OS X machine you might want to consider installing POW since it’s making it much easier to work with Jekyll locally. Once POW is installed open your Terminal and go to ~/.pow and create a symlink to the octopress-repo root.

$ ln -s /Users/yourUsername/Documents/octopress myapp

Now open http://myapp.dev in your browser to check if it’s working so far.

##Import the “old data”

Create a folder _import inside the octopress/source directory and put the blogml.rb conversion file in there.

$ cd octopress/source
$ mkdir _import
$ cd _import
$ wget https://github.com/philippkueng/philippkueng.github.com/blob/30ef1570f06d33938b18d5eee7767d6641b9a779/source/_import/blogml.rb --no-check-certificate

This import script was actually created by @derekmorrison to assist him by Moving to Jekyll. Since URLs have to be rewritten because of the .aspx extensions which are part of BlogEngine I slightly modified the script to additionally create an .htaccess file and to play nice with non-ASCII encoded post-titles.

Next, move the BlogML.xml file inside the source directory and also create two seperate folders called files and images inside source. Then copy the contents of the previously dumped App_Data/files folder to their respective folders (images or files) by keeping the path structure intact. Means, that App_Data/files/2010/2/file.zip will go to octopress/source/files/2010/2/file.zip.

Now to the fun part, open your Terminal and navigate inside your octopress/source directory. Then execute:

$ ruby -r './_import/blogml.rb' -e 'Jekyll::BlogML.process("BlogML.xml")'

This should have imported all your existing posts so that you can now generate your Jekyll blog from it by exiting the source directory and issuing the rake command.

$ cd ..
$ bundle exec rake generate

##Deploying

There’s already documentation available on how to deploy Octopress to various hosting platforms. Since you’re migrating from BlogEngine I highly recommend running your own VM or getting a shared hosting account with .htaccess support in order to not let your visitors down with feeding them broken links. Actually since Heroku is offering their polyglot Cedar-stack you should be able to run .htaccess on there too. YMMV

If your hosting provider is only offering FTP, then deploy manually by uploading the contents of the public folder and adding the .htaccess file from inside the source folder.

##Fixes

We’re not quite done yet. Log into your Google and Bing Webmaster account and replace the sitemap.axd entry with sitemap.xml. The same goes for your Feedburner account, log in and replace feeds.axd with atom.xml.

Finally fix the disqus comments. Log into their dashboard and select the account you want to migrate. Then click on the Tools tab and afterwards the Migrate Threads navigation entry. Hit the Start Crawling button for the Redirect Crawler Migration and your done.

##Update - 14th april 2014

Eric Duncan migrated his CommunityServer blog to Jekyll too by modifying the BlogML import script (see comment below). For further details on how he did the migration, head on over to his blog where he also provides a couple of ethical reasons why one should move to a public and versioned blog.

Comments