Blosxom Hacking
Considering that they remain a subculture, webloggers have certainly spawned an impressive arsenal of software to grease the wheels of their online self-publishing. Moveable Type seems to be the heavyweight (and I do mean heavyweight) champ among weblogging apps, but there are a number of other contenders (Dean Allen’s Textpattern, in particular, seems to be an up-and-comer).
When I began to consider reviving my own weblog several weeks ago, I knew that I would need a better content management system than the old, self-designed, PHP-based setup I once used. None of the choices really appealed to me, however, until James Duncan Davidson’s weblog turned me onto Rael Dornfest’s entry into the fray, Blosxom.
Blosxom’s killer feature, as Rael will readily tell you, is its simplicity. Installing Moveable Type entails negotiating an enthusiasm-stifling array of scripts, libraries, and configuration files, but installing Blosxom only requires that the user drop a single Perl script on a web server and edit a few global variables. Moveable Type requires a back-end database, which necessitates the use of specialized front-end editors, but Blosxom entries are simple text files stored in a directory hierarchy, and can be created and edited using any text editor. In its own minimalist way, Blosxom supports most of the features of the big boys—an RSS feed, categories, index pages, single entry permalinks, static and dynamic rendering—in a much smaller footprint.
Moreover, since Blosxom is so simple, and since it was written in Perl, it is a trivial matter for the “do it yourselfer” to add features that the standard distribution lacks. In this spirit, I offer the following, ever-so-simple Perl script, which compensates for one of my only frustrations with Blosxom: the fact that it relies on the system date and time to determine how blog entries are displayed. Nobody’s perfect, after all, and sometimes blog entries need to be edited or updated after their initial posting. This script, quite simply, makes it possible to edit the contents of a file without changing its last modified stats, so that Blosxom will continue to display the entry’s original posting date and time.
#!/usr/bin/perl
use File::stat;
$file = $ARGV[0];
if (!defined($file)) {
print “ERROR: Please enter a filename.\n”;
}
else {
$mtime = stat($file)->mtime;
system ‘vi’, $file;
utime time, $mtime, $file;
}
Simply save this in a file (call it “blosxom_edit” if you like) and run “chmod 755” on it. You should then be able to type something like “blosxom_edit BlogEntry.txt” and edit the file using vi without changing the date.
Users of Mac OS X and that most venerable of text editors, BBEdit (6.5.3 or above), may also be interested to know that they can replace the line that executes vi in the code above with the following:
system 'bbedit', '-w', $file;
Of course, this last trick will only work if you’re editing your blog entries locally on your Mac (not using telnet or something like that).