The problem I’m having with Movable Type is I don’t like how the permalinks work. Since using Blosxom, I’ve grown accustomed to permalinks of the type such as http://domain.name/yyyy/mm/dd/slug, which happens to be the default format of Wordpress and Mephisto. (This was actually one of the reasons I wasn’t fond of Typo, because of the it inserts the word article between the domain name and the year. I found this unnecessarily crufty.)
The other problem is that when I imported my Wordpress entries into Movable Type (via the rather ugly WXR [Wordpress Extended RSS] format), the imported chewed up all my URLs, and removed all the dashes. Hence, my old permalinks no longer work. I guess I could write a regex .htaccess to likewise strip out dashes in requests, but that is, as they say, mere kludgery.
So here we are. Back on Mephisto.
Well. It’s hot. What can I say. I’ve spent the entire day floating from cafe to cafe because I couldn’t stand benig inside my air-conditionless apartment. (I really dug Influx Cafe, and they even have free wi-fi!) After that I even headed over to Fry’s (after almost getting into an accident after a guy popped a tire on the freeway and nearly rammed me as he headed to the shoulder) and contemplated buying a portable air-conditioner. But seeing as how I don’t have $399, I ended up leaving empty-handed.
Instead, I am sitting in front of my electric fan and chugging ice-cold bottles of water.
Yes.
So it looks like I successfully imported my Wordpress entries into MT by importing the WXR file. Which led me to another blogxistential dilemma: categories or tags?
Because of my experience with Blosxom, which, due to limitations of the file system, only allows you to file a post in a single category (unless you apply some perl hackery to get it to honor symlinks without double-posting), I started off blogging on Wordpress in much the same manner. But after growing accustomed to using del.icio.us for bookmarking, and after revelling in the near-absolute anarchy of folksonomies, I started getting a little crazy with how I categorized my blog posts, sometimes stuffing them in four, five, or more categories which I probably would never use again. Tags were clearly more appropriate for this, but Wordpress still doesn’t have them as of version 2.2.
Both Typo and Mephisto (and Movable Type) let you use both categories and tags.
While in Ruby-on-Rails-land, I found the notion of using both overkill, and just used tags. I mean, it seemed like too much work to categorize and tag. But now that I’ve re-imported my Wordpress posts, I have to figure out what to do with all the categories again.
What I need is a painless way to change categories to tags. Actually, all I probably have to do is munge the WXR import code and change mt_category to mt_tag or something like that. But I don’t want to have to delete all the imported posts then re-import them. And besides, apparently Dreamhost is now having DNS woes. I actually only have one domain registered via Dreamhost, but unfortunately it’s (1) the domain that gets the most traffic (thanks to my Alibata/Bayinbayin site and the transliterator—you’ll probably have to pull it up on Google’s cache for now) and (2) the domain that I’ve been storing images on for blog posts. So that means that if I want images in my old posts, I’m going to have to find them and re-import them into MT. Fabulous. (Which leads me to wonder, are there any blog-engine-independent asset manager web apps out there?)
The upshot of all of this is that I’m probably going to just have to manually run through the 400+ blog entries I’ve written since February 2006 (What is wrong with me? I need to make more friends whom I can talk to, instead of always blogging about my woes.) Guaranteed fun times.
Since my old Blosxom blog is actually still hosted on the domain that is currently inaccessible, I wonder if I should try to import those entries into MT as well? (While the domain is inaccessible, I can still get to the server, so I could theoretically copy them over to another domain that’s registered elsewhere.) Madness.
Pardon my French, but it’s hotter than a motherfucker out there. This wouldn’t be a big deal at all if I actually had air-conditioning. I’m actually contemplating the idea of renting a hotel room just so I can turn the thermostat to 55 degrees and chill. Literally.
So it looks like I have all the posts I wrote with Typo and Mephisto in one form or the other scattered across three computers. Now all I need is an XSLT stylesheet to convert Atom to WXR (Wordpress Extended RSS, which is an XMLish dump of a Wordpress database.) Unfortunately, Movable Type only knows how to read it’s native non-XML flatfile format and WXR. This is definitely a shortcoming. That said, I may just not have looked hard enough for a plug-in that will let me import Atom.
But so far, I’m digging Movable Type. I haven’t taken a gander at the code yet, and I know that Movable Type has been around for a long time, making it susceptible to cruftiness. (For an example of cruftiness, just look at Wordpress.) But there’s something to be said about tried-and-true.
Now, bear in mind, there are decent scripts lurking in vendor/plugins/mephisto_converters that will do a reasonable conversion from either Wordpress→Mephisto or Typo→Mephisto. The problem that comes up, however, is the dichotomy between categories and tags. While I was still using Wordpress (which only offers categories and does not offer tags), I was basically using categories as tags. I never really did get into the whole semantic partitioning between categories vs. tags and find that tags alone satisfy my organizational mindset (meaning, complete chaos, but I digress.
I will not go into how to use these converters, as you can follow these instructions regarding converting from Typo→Mephisto. I imagine the conversion from Wordpress→Mephisto is quite similar, although I haven’t tried it myself.
But, given the aforementioned dichotomy between categories and tags, my previous migration from Wordpress→Typo correctly imported the Wordpress categories as Typo categories. However, for some strange reason, I decided once I started using Typo to only use tags and not categories. This resulted in about a year and a half’s worth of posts with categories but no tags, and a week’s worth of posts with tags but no categories.
I then proceeded to migrate all the posts from Typo to Mephisto (using the instructions I mentioned above.) Unfortunately, the migration script seems to only pick up one set of delineators (categories OR tags, but NOT both). And not only that, it munged the tags that I did have as described, joining them all into single supertags with embedded commas. Not exactly what most people want.
Since there were only 10 or so posts from the previous week while I was using Typo, I ended up just manually fixing all the tags. However, this left all of the Wordpress categories that did not survive the transition through two blog systems. I transiently entertained the notion of manually tagging each and every post, using a backup of my Wordpress database as a reference, but I soon came to my senses and decided to do this programatically.
The following is based entirely on the code from the above referenced website that fixes Mephisto tags based on Typo tags from the Typo database, except that I was fixing Mephisto tags based on Wordpress categories from the Wordpress database. You can just enter all of this at the ./script/console prompt:
require "converters/base"
require "converters/word_press"
WordPress::Post.find(:all).each do |wp|
mp = Article.findby_permalink(wp.postname)
wp.categories.collect{|c|c.cat_name}.each do |cat|
Tagging.set_on(mp,cat)
end
end
This is just a quick outline of the steps I took, which I hope to fill in as time goes on.
This route is really circuitous, mostly because the migration script included with Typo is apparently very CPU/memory-intensive, and Dreamhost’s sentinel processes always ended up reaping it before it could even import a couple of blog posts. It also requires the installation of random pieces of software you probably won’t normally use on your local machine. Be forewarned.
NOTE: My desktop computer is a Mac Mini PowerPC G4 running at 1.25 GHz with 1 GB of RAM installed, running Mac OS X 10.4 Tiger. These instructions should be equivalent for an Intel-based Mac, and should be reasonably adaptable for Linux, BSD, or other UNIX/UNIX-like systems. Unfortunately, I haven’t run Windows since 1999, so I can’t really help you there.
- Export your Wordpress database using whatever method is most comfortable to you. I used myPHPadmin which is available by default on Dreamhost. Transfer the resulting flatfile to your local machine.
- Make sure you have MySQL running on your local machine. Of interest, MySQL is installed by default in the Server version of Tiger, although turned off by default. It should be pretty easy to install MySQL on any respectable Linux distribution. On the Client version of Tiger, while you can build
mysqlusing Fink or MacPorts, the easiest thing (read: the thing that involved the least amount of thinking and/or compiling) was to just download the binary distribution from mysql.com. The stable version as of this writing is 5.0. - Install CocoaMySQL. Obviously, if you’re quite familiar with dealing with MySQL on the command-line, there’s no need to do this, but since I’m not, this was the easiest thing to do.
- Import your database from Dreamhost into your local copy of MySQL
- Make sure you have a functioning copy of Ruby installed. Tiger comes with an old version of Ruby installed, so I tried compiling the newest release with Fink. Unfortunately, there are still some issues with compiling Ruby using gcc 4. While it will build without problems, Ruby will segfault randomly when run. Since I didn’t really want to screw around with compiling with gcc 3.3 and making sure all the relevant dependencies would play nice, I ended up installing Locomotive, which lets you run Ruby on Rails applications in a sandboxed environment.
- Install Rails. Again, Locomotive will take care of this for you, but if you’re running Linux, or you manage to get ruby correctly compiled on Mac OS X, you can just install the gem like so:
gem install rails --include-dependencies - Make sure you have
svninstalled. Subversion, a version control system, is readily available on all respectable Linux distributions and can be compiled without incident on Mac OS X via Fink or MacPorts or even just from source. - Download typo via svn. You can pretty much install Typo anywhere you like. Once you’re in the directory (folder) of your choice, type:
svn checkout http://svn.typosphere.org/typo/trunk typo(see the Typo Trac for more info about grabbing the trunk versus the 4.1 branch.) - Create a new database for use with Typo.
- Configure Typo to use the new database Edit
config/database.yml(relative to the directory you downloaded Typo to) so that it’s pointing to your new database. - Format the new database with Typo’s schema. I used
rake db:migrateOther ways (not sure if this is up to date) are described on the Typo Trac. These should work just as well on your local machine as it does on Dreamhost’s servers. - Run the Wordpress 2 → Typo 4 converter script. (If you’re using Locomotive, at this point you’ll need to create a new project and point it to where Typo is living, and start it.) Type
db/converters/wordpress2.rb --helpfor help with the syntax with converter. - Export the Typo database on your local machine.
- Create a new database on Dreamhost for Typo.
- Import the flatfile from your local machine into the database on Dreamhost.
- Install and configure Typo on Dreamhost exactly as above. From what I can tell, Dreamhost now has a current enough version of Ruby (1.8.5) and Rails (1.2.3) to run Typo properly, but if you must have the newest versions of everything, you can build it all in your home directory.
At this point, you should be able to point your browser to your site and create an admin account. All your Wordpress posts will be there, although the converter script turns all your entries and all your pictures into separate blog posts.
Right now, I’m running Typo out of the box without having to put in the hackery used to avoid getting 500 errors. Compared to a year ago when I tried Typo out, it feels a lot faster and more responsive, although it is still kind of slow. We’ll see how it goes.
One thing that I found irksome, and for which I couldn’t find an easy solution to on Google, is that Typo’s permalinks are formatted like so: http://domain.name/articles/yyyy/mm/dd/slug In contrast, Wordpress’s permalinks are http://domain.name/yyyy/mm/dd/slug. Personally, I feel that articles is unnecessarily crufty, but I couldn’t figure out an easy way to get rid of it. I couldn’t get Apache’s mod_rewrite to work with Typo either. So this is what I ended up having to do to at least keep my Wordpress permalinks alive. (Derived from WordPress to Typo Migration, Part II.)
In config/routes.rb, add this:
map.connect ':year/:month/:day/:title',
:controller => 'wordpress_url', :action => 'redirect',
:requirements => {:year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/}
This will require you to create a new file in app/controllers/ called wordpressurlcontroller.rb
app/controllers/wordpressurlcontroller.rb contains the following:
class WordpressUrlController < ApplicationController
def redirect
year = params[:year]
month = params[:month]
day = params[:day]
title = params[:title]
url = "/articles/#{year}/#{month}/#{day}/#{title}/"
redirect_permanently url
end
def redirect_permanently url
headers["Status"] = "301 Moved Permanently"
redirect_to url
end
private :redirect_permanently
end
Now, I’m a Ruby/Rails newbie, so if there is a cleaner way to do this, or if there is a way to get rid of articles from the permalink, suggestions would be appreciated.
On the off chance that you actually cared, I’ve changed this blog’s URL. You will find the latest drek escaping from my vacuous soul at http://disorderedthoughtprocesses.com, and for once the domain name actually matches the title. This will be a transparent process, thanks to the beauty that is the Apache Web Server, and thanks to the beauty of Wordpress itself.
You would think that this would be something well-documented and easy to find, but not even the awesome powers of the Googlebot manages to get this on the first try. In case you actually want to know how to move your Wordpress blog from one server to another with the least amount of hassle, try this (you will need Wordpress 2.1 or greater):
- Go to the Dashboard of your old blog and click on the ‘Manage’ tab.
- Then click on the ‘Export’ tab.
- Click on the ‘Download Export File’ button. This will save a large XML file to your hard drive which contains the entire contents of your blog, including entries, comments, and other uploaded files.
- Go to the Dashboard of your new blog and click on the ‘Manage’ tab.
- Click on the ‘Import’ tab.
- Click on the ‘Wordpress’ link.
- Use the file picker and find the aforementioned large XML file that contains the entire contents of your blog.
- Click on the ‘Upload file and import’ button
Voila!
The one thing that worries me is the 7 MB limitation. I’ve only been using Wordpress for a year and a half now, and I’ve already gotten to about 4.5 MB. Hopefully a year and a half from now, this limitation will be fixed.
Oh, and if (1) the domain of your old blog will remain active, (2) you have shell access to your website, and (3) your setup allows the use of .htaccess files, the following will seamlessly redirect your readers to the new URL:
- Delete or rename your existing
.htaccessfile. It generally resides in the root directory of your Wordpress installation, and will typically be invisible. In Unix and related OSes in which Wordpress generally runs, this means typing the following at the command line to delete the file:rm .htaccessOr you can use the following to rename the file:mv .htaccess whatever-filename-you-want - Use your favorite text editor to create a new
.htaccessfile. For example:emacs .htaccess - In this file, place the following line:
redirect 301 / http://new-blog.domain-name.com/
Once you save the file, redirection should work right away, although apparently it takes Google a while to reindex your site, so you may see a significant drop in traffic.
(Sources:
