Functional Flow

Migrating From SubText to BlogEngine.NET

| Comments

My blog was running in SubText, but I’ve recently changed to BlogEngine.NET. The main reason for the change was that BlogEngine.NET supports storing the data in plain XML files, without having any dependency to a database. This makes it really easy to customize, as I can develop everything in my local machine, and then just send the files to the server. With SubText this was harder to do, so I ended up doing fewer tweaks, and doing them directly in production, which I didn’t like.

The migration wasn’t as smooth as I though it would be, so here are the steps I took, in case someone needs to go through a similar process:

  • Exporting to BlogML and then importing didn’t work correctly. After exporting, I had to convert the content from Base64, replace the &’s in the titles with &, and then manually set the author in all post. I also had to set the tags manually in all posts, as in SubText they weren’t a separate field but instead were part of the content of the posts. Having the posts on xml files on disk rather than on a database eased this job a lot.
  • The TinyMCE bundled in BlogEngine.NET doesn’t support images, so I had to replace it with CKEditor and CKFinder.
  • The SubText post URL's have the format /archive/year/month/day/name-of-the-post.aspx, while BlogEngine.NET post URL's have the format /server/post/year/month/day/name-of-the-post.aspx. I had to set up redirection so the old links would keep working. To do that I’ve taken the source code from BlogEngine SEO Redirection extension and changed the comparison to only check prefixes (source code here).
  • Several of the extensions available out there don’t work out of the box with the latest version of BlogEngine.NET (2.5):
    • For the AddThis extension I had to add some missing using’s to the code, and disable the form validation of the settings page (source code here).
    • To be able to configure widgets in the AllTuts theme, I had to make a small bug fix (as described in Janier Davila comment here)

After all that work, now I have a setup that allows me to tweak the blog very easily. I have it on GitHub, cloned into my local machine and into the server. I can play around locally, and when I’m glad with the results I just need to do a git push locally and then remote desktop to the server to do a git pull and force a reload of the application by touching the web.config.

Of course, to protect my passwords and keys, I have to tell git to ignore users.xml, akismetfilter.xml and recaptcha.xml, using this procedure. And I also must take care with the email settings that are stored on the global settings.xml file, which forces me to always have that file uncommitted at the server, but other than that, it’s orders of magnitude better than editing directly on production.

Comments