I finally made good on my promise to
restore the old entries from when this blog was running on dasBlog. I tried my best to make sure
you people reading this through RSS didn’t get a bunch of duplicated
posts, but if your reader refreshed at the wrong time you might
have. This operation is not yet big enough to warrant a separate test
server, and besides, we’ve already established that I’m a lazy lazy
man.
The job ended up being more than 15 minutes of quick-and-dirty
scripting, mostly because the old data was full of small gotchas (one
example: in blosxom everything is
files, so it’s a good idea to have descriptive file names. The most
descriptive thing in my old entries was, naturally, the
title. However, that wasn’t unique (I made a lot of posts titled
”Quickies of the day”, for examples), and so I had to implement
”Windows-style” name un-collision code (e.g
quickies_of_the_day_2.txt)
If someone wants the code, it’s here.
Run it like "dasblog2blosxom.pl *.dayentry.xml >
redirect.map". The redirect.map file is for making sure
that old dasBlog URLs still work with Apache’s mod_rewrite and the
following rule set:
RewriteEngine On RewriteMap testmap txt:/path/to/redirect.map RewriteCond %{QUERY_STRING} ^guid=(.*) RewriteRule /PermaLink\.aspx ${testmap:%1} [R=301,NE] RewriteCond %{QUERY_STRING} ^guid=(.*) RewriteRule /Trackback\.aspx ${testmap:%1} [R=301,NE] RewriteCond %{QUERY_STRING} ^guid=(.*) RewriteRule /CommentView\.aspx ${testmap:%1} [R=301,NE]
(big up to has for helping me with the mod_rewrite magic)
There are probably bugs that weren’t exposed by my blog data. Also,
I’m stil new to Python programming, and things might not be done in
the most pytonish way. Do not use the code as a guideline on how to do
stuff.
The comments that people wrote in on the old setup are not yet
restored. That is a project for another late night.