Blogs

RedMonk

Skip to content

More on the MT to WordPress Migration

As Jeff was kind enough to point out in a comment, and I’ve since come to understand this evening, my initial plan to generate .htaccess redirects purely from my Movable Type database isn’t going to fly because WordPress uses a different URI scheme, and doesn’t import any of the fields I was planning on using as keys (entry_id, entry_basename, and so on). It merely imports the content: entries, comments, and so on. While I could probably use the custom fields plugin for WordPress to allow for the missing content types, I have no simple way to key a loading process, as MT and WP don’t have anything in common apart from date. As far as I can tell, anyway.

Fortunately, the problem is not a unique to me and has been solved before. The WordPress documentation lists two probably workable solutions: one is a new template for Movable Type written by none other than Denver’s own Alex King, and a second that borrows from that approach but employs a custom .htaccess file instead. Basically, these work by reading through your MT database, pulling out a date, calculating what WordPress would name the entry, and generating from that the WordPress URI. In other words, it takes my existing entries, which go something like:

redmonk.com/sogrady/archives/002446.html

to

redmonk.com/sogrady/archives/2006/10/29/reading-the-mt/

Not too far off what I was trying to do earlier today. And actually, maybe I can just port the WP Sanitize function over to Ruby and use my script (I’m more comfortable in Ruby than PHP, in case that wasn’t already obvious).

To guarantee that “sanitize title” function in either template accurately anticipates WP’s version of the entry_basename attribute, I’m assuming it just uses the same logic that WP does on import (Alex’s template reads “taken from WordPress” so that seems a safe assumption). I’ve begun playing with these, and if you noticed anything weird with the site tonight that’s why; I accidentally rebuilt all the templates for my blog running on hicks rather than on my test box – that’s the price of having your test and dev environments side by side. Should be back to normal now though.

If I get time on the plane tomorrow I might try to play around with these scripts, but first I need to get MT working on my machine – I’m apparently missing some Perl dependencies.

One other thing: a couple of you have asked what’s up with the formatting in my feeds lately, and the answer is I have no idea. I’m still authoring my posts in GEdit, doing the markup by hand, and it looks fine on the site – but for some reason the feed is garbling the layout. Apologies.

Categories: RedMonk Miscellaneous.

  • http://blog.johnjosephbachir.org/ John Bachir

    if you want to, you can make your wordpress url include the old id, and then when you transfer your content, actually use the same post ids (since you will be starting with an empty wordpress posts table this won’t be a problem)

    OR you can write a script that will simultaneously generate the new wordpress slugs AND the corresponding rewrite rules. but then you are going to end up with an entire rule per document.

  • http://www.redmonk.com/sogrady stephen o’grady

    “if you want to, you can make your wordpress url include the old id, and then when you transfer your content, actually use the same post ids (since you will be starting with an empty wordpress posts table this won’t be a problem)”

    how would one go about doing this? i’m not sure i would, since i believe having both the data and title information would be good for search engines, but it’s interesting nonetheless.