Migrating from dasBlog to Wordpress

Blogging August 5th, 2008

I’ve recently decided to move my blog from dasBlog to WordPress. The reason for this move is mainly because dasBlog really lacked several features that were important for me and I found WordPress to be much more mature platform with a wide community support.

Moving the blog to WordPress turns out to be not as complex as I thought it would. However there are some pitfalls that are important to avoid in order for the process to really be as quick and simple as possible.

When moving our blog we have two main tasks: migrate all the blog’s data (post’s etc.) and ensure that the old blog redirects all calls to the new blog so that we don’t loose search engine links\ranking and confuse readers.

Migrating Blog Data

WordPress does not support importing from dasBlog out of the box and there’s no available plugin that does that. The best way I could find to migrate the data to WordPress is to use RSS import. The only downside here is that comments will not get imported :(

In order to migrate dasBlog posts to WordPress using RSS perform the following:

  1. Setup dasBlog’s RSS to contain all your data. On dasBlog’s configurations page, under Syndication Settings, increase the number of items in your RSS feed to cover all posts.
    image

    Also, turn off FeedBurner support so that when trying to access dasBlog’s RSS feed it will not redirect you to FeedBurner.

  2. Disable Aggregator Bugging. dasBlog can add an image to your RSS item that is used to gather feed usage statistics. You don’t want those images to be part of your WordPress posts.
    To disable feed bugging simply go to the dasBlog configuration screen and uncheck the Enable Webbugs for RSS checkbox in the Service Settings section:
    image 
  3. Save the RSS as a file. Load the RSS into your browser by clicking on the RSS icon on your blog’s home page or by navigating to http://<blog url>/SyndicationService.asmx/GetRss.
    Save the displayed XML to a text file on your local drive.
  4. Fix content formatting in the RSS. You have to remove end-of-line characters from the file, otherwise they will be transformed by WordPress during import to line breaks that will mess up your posts layout:
    1. Open the file in Microsoft Word, press CTRL+H to open the Find and Replace dialog.
      Click on More->Special Characters->Paragraph Character. Replace it with nothing (an empty string).
    2. Replace all double spaces with one space character.
  5. Import the file to WordPress. In the WordPress Admin Dashboard go to Manage->Import (or navigate directly to http://<blog url>/wp-admin/import.php). Click the RSS link and browse for the RSS file you just edited. Click Upload file and import button to import your content to WordPress.

Redirect Requests from dasBlog to WordPress

If you’ve been using your blog post title for your post’s permalink than you’re going to have a relatively easy job redirecting all the requests made directly to a post on your dasBlog blog to their new location on WordPress (some coding is required though). Handling the other pages - archive, date and category pages - is a bit more complicated.

First, configure WordPress’s permalinks to use the post’s title like dasBlog. In the WordPress Admin Dashboard go to Settings->Permalinks and choose the Day and name option so that your permalinks will look as follows : http:// <blog domain> /2008/08/04/sample-post/

Now we have to redirect the requests from the old blog to WordPress. I couldn’t find a way to perform this without editing dasBlog’s source code. To be honest, I’ve been running my own customized version of dasBlog for a while now so I’ve had the code ready for use and I didn’t invest much time in looking for alternatives.
In the newtelligence.DasBlog.Web.Core project, open SharedBasePage.cs and add the following code snippet at the end of the SetupPage method:

// *** Redirect to WordPress
string redirectUrl = "http://<blog homepage>.com/";
if (!this.IsAggregatedView)
{
    // We're looking at an indevidual post so we can redirect directly to
    // that post's new location
    Entry entry = DataService.GetEntry(weblogEntryId);

    redirectUrl = string.Format("http://<your blog>/{0}/{1}/{2}/{3}/",
        entry.CreatedUtc.Year,
        entry.CreatedUtc.Month,
        entry.CreatedUtc.Day,
        entry.CompressedTitleUnique.Replace('+', '-'));
}
else
{
    if (Request.QueryString["category"] != null)
    {
        // We're in a category page
        redirectUrl = string.Format("http://<your blog>/redirectFromDasBlog/category/{0}", this.CategoryName);
    }
    if (Request.QueryString["date"] != null)
    {
        redirectUrl = string.Format("http://<your blog>/{0}/{1}/{2}/",
            DayUtc.Year.ToString(),
            DayUtc.Month.ToString("d2"),
            DayUtc.Day.ToString("d2"));
    }
    else if (Request.QueryString["month"] != null)
    {
        redirectUrl = string.Format("http://<your blog>/{0}/{1}/",
            Month.Year.ToString(),
            Month.Month.ToString("d2"));
    }
}
this.Response.StatusCode = 301;
this.Response.Status = "301 Moved Permanently";
this.Response.RedirectLocation = redirectUrl;
this.Response.End();

Compile dasBlog and then replace newtelligence.DasBlog.Web.Core on your dasBlog’s bin folder with the modified version.

The snippets redirects requests to blog posts and archive pages (day pages and month pages) to their new destination on WordPress using permanent redirect status code (301).
Category pages cannot be handles automatically as, when moving to WordPress, you will probably play around with the category hierarchies, names and slug.
Therefore, the code builds a category URL that points to the WordPress blog and guaranteed to get a 404 error. We can track 404 hits on WordPress and manually configure where to direct them…

Track and redirect 404 requests on WordPress. A WordPress plugin, called Redirection, allows you to track 404 errors and manage their permanent (301) redirections:

Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.

Install the plugin and then you can go to Manage->Redirection on the WordPress Admin Dashboard and manage redirections from the fake URLs created by the code we added to dasBlog to real destinations on your new WordPress blog.

That’s it! If you’ve reached this far you’re covered…
All the posts have moved to their new WordPress location and all links are correctly forworded to the new location. As mentioned earlier, unfortunately, the only thing left out are the blog comments.
If you know of a way to get the comments migrated to WordPress too please do tell…

Technorati Tags: ,

Tags: ,

Apology to My Readers (Buggy dasBlog Contact Form)

Blogging June 10th, 2008

There’s nothing that pleases me (and I guess, any blog owner) more than getting feedback on my blog.
While I do my best to respond to comments as soon as possible some of you who contacted me through dasBlog’s contact form are probably wondering why I’m ignoring you. Well, I’m not!

It seems like there’s a bug in dasBlog’s form - although the form specifically asks for your E-mail address it does not use that information for anything.
So when I get the email notification I only get the comment text without the E-mail to respond to (unless your signature includes it).

I will replace this form with a better alternative as soon as I get home.
If you’ve been waiting for my response please accept my sincere apologies and feel free to write again (and include your email in the comment text).

Technorati Tags:

Tags:

dasBlog 2.1 Released

Technology May 12th, 2008

dasBlog 2.1 just got released on its new home at CodePlex: http://www.codeplex.com/dasblog

You can read about the new release and the move to CodePlex on on dasblog.info:

About version 2.1

This version is predominately a bug fix release with a number of other small features and incremental improvements. Our 2.0 release was based on source revision 730 and 2.1 is based on source revision 813. So you see there has been tons of activity in the background.

Some of the bugs squashed are:

  • Search result was displayed multiply times instead of once.
  • Theme picklist displayed multiply times instead of once.
  • Zip file creation of log files failed in certain cases
  • Cross posting between multiply blogs failed in certain cases
  • Better support for white space with the CSS PRE command for text formatting of sample source code etc.

Some of the new features are:

  • GeoRSS support
  • Several new user created macros for paging and theme layout improvements (currently only documented in the source);  CommentsCount, IfCommentsRawText, IfItemRawText, IfViewPermalinkUrlRaw, IfParamRawText
  • Macros; OnPagePreviousLink/OnPagePreviousLink (Renders links to the previous and next posts on the same page, only in list view)
  • Macros;  IfModified (prints localized text if entry was modified) - Modified, FormattedModified, FormattedModifiedBare (prints modified date/time if the entry was modified)

kick it on DotNetKicks.com

Technorati Tags:

Tags: