After more pain than I thought that I would go through, I finally finished converting my old CityDesk site over to Movable Type. The pain was largely due to two fairly major problems that I encountered along the way.
The first problem was due to the way that Movable Type wanted to maintain my entry archives. I used the individual entry archive option, which results in the generation of archive entries like “000001.html”. However, I wanted to make sure that I didn’t break any external links to my existing archive entries which had names like “http://www.iunknown.com/Archives/fog0000000030.html”. To map between the two, I used an Apache .htaccess file to map the old URL’s to the new URL’s.
While I only have 257 entries in my weblog, I really didn’t want to create my .htaccess file by hand. To solve this problem, I needed to write some code that would let me export the existing URL’s for my archive entries from CityDesk. I wrote earlier about Brian Cantoni’s excellent script for exporting entries. I had to modify Brian’s script somewhat (for example, I export my entries by ascending date/time since I wanted my weblog entry to be “000001.html” and not “000257.html”). Also, I needed to generate XML in my export script since I would run over that script using a C# app that I wrote to solve nasty problem #2. Here’s the CityDesk script that generates an export file called entries.xml:
<?xml version="1.0" encoding="windows-1252"?>
{$ setDateTimeFormat "English" "MM/dd/yyyy" "hh:mm:ss tt"$}
{$foreach x in (folder "Weblog") SortAscendBy .filedDate$}
<entry>
author>John</author>
<title><![CDATA[{$x.headline$}]]></title>
<date>{$x.fileddate$} {$x.filedtime$}</date>
<status>Publish</status>
<link>{$x.link$}</link>
<body><![CDATA[{$x.body$}]]></body>
</entry>
{$ next $}
</entries>
The second problem had to do with my comments. For my old site, all of my comments were managed by Haloscan, who for over a year provided me with comments on my web site. Unfortunately, they don’t currently offer an export option to dump all of my existing comments out as an RSS file; I had to write some code to screen-scrape their existing site. Fortunately for me, most of their comment pages are valid XHTML, so I was able to do the requisite screen-scraping using XPath. Unfortunately, they don’t correctly escape “&” and a few other characters so some of my comment pages didn’t migrate automatically over. I still need to manually migrate those comments over to MT.
If you’re interested in the code that I wrote to manage my migration, you can download it here.
One final note: I posted this entry using w.bloggar, which is quite a nice offline editor. One thing that would really improve w.bloggar would be to use Microsoft’s DHTML editing component as the editor within w.bloggar, much like what CityDesk does already.
3 archived reader comments
John Lam (2003-05-27)
Test comment
Brad Wilson, The .NET Guy (2003-05-27)
So, congrats. When are you going to put full content into your RSS feed so we don’t have to visit the site to read every post? :)
John Lam (2003-05-27)
Done! Thanks for reminding me to do that.