Using Correct Titles


I was going through Jon Udell's slides from his talk at OSCOM last week and his discussion of using the right titles on web pages caught my eye. It pointed to this column he wrote called The Google API is a Two Way Street. As I read through these, I realized that this was the answer to a problem that had nagging at me for some time: when I search the pages on my blog, the titles are all the same and, consequently, not very helpful.

Fortunately, Jon even supplied a script for Radio Userland that partially solves the problem. Partially, in the sense that Radio, unlike some other systems, doesn't give each post a fresh archive page, but collects all the posts from a single day onto a "day post." So you have to pick one title for the day. Jon picked the most recent post for that day and that's a reasonable solution. I'd rather Radio put each archived post on its own page. I use a Mac, so there were a few changed I had to make to Jon's script. The original script contains these lines:

scratchpad.archiveDate = year + "\\\\" + string.padWithZeros(month,2) + 
           "\\\\" + string.padWithZeros(day,2); 
scratchpad.archivePath = "c:\\\\radio\\\\www\\\\" + scratchpad.archiveDate + ".txt";

This is very Windows specific. To make the script more general, I changed them to this:

scratchpad.archiveDate = year + file.getpathchar() + 
      string.padWithZeros(month,2) + file.getpathchar() + string.padWithZeros(day,2);
local (basefolder = user.radio.prefs.wwwfolder)
scratchpad.archivePath = basefolder  + scratchpad.archiveDate + ".txt";

This should work on either platform. One word of warning: The code uses the scratchpad to store a lot of data. This is a nice way to be able to watch scripts run and great for debugging, but its a global namespace. If you get two instances of the script running at the same time, you'll get interesting results. I discovered this because I was debugging some things and so was hitting "Run" and then "Kill" to start and stop the script as I saw what needed to be changed. Unfortunately, "Kill" doesn't really stop the script. Once its off and going, you just need to let it go as far as I can tell. Fortunately, I was running it against a copy of my site, not the real thing because when it was done, the archive files were mincemeat.

At any rate, once Google catches up with my site, I expect the new titles will be much more helpful in finding things. I just reindexed my blog with Atomz and the results are much better.