Posted on March 19, 2004
Filed Under page_titler | Comments Off on Page Titler 0.2
I’ve made some modifications to my page_titler plugin. Before, it would act upon only the main unqualified page. It had some funky logic to skip what it was doing if this was a page view or a category view or something, but that never seemed to work quite right anyway. Loading the page of recent writebacks would always screw up the cache and there were other situations like that. Now, you have configuration variables that will allow you to decide whether to turn it on in the page and/or category views. If you do, it will title any of those pages and save a cache based on it and keyed off of the subdirectories.
The whole rationale of this plugin is that I like to have the title of the top story in my HTML title tag. However, by the time blosxom reaches the point where it can tell what the top story is, the top part of the web page has already been written. This plugin will cache out what the top story is for that URL and on the next load for it use that as the title. This means that the first load of any given URL will always have either no title or the title from the previous story and after that they will be right. By adding in the ability to keep a list of them keyed by the URL, not only does the main page work a lot better but the subpages have titles too!
The cache is stored as a very simple colon delimited file, not using Storable or anything fancy like that. Since the colon is not a valid character in an URL string, this shouldn’t ever be a problem (colons in the title won’t hurt anything.) Here is an example from my current cache:
2003/08/01:Cringely is a True Evil Genius :One and Done arts:The Crisis Continues misc:Quote of the Day arts/books:Book Crossing 2003/09/04:Winding Down life:There and Back Again 2003/10/23:More on Elliott Smith misc/030909_04.writeback:RIAA PSA arts/sciencefiction/conventions:OryCon ?recent=7:Book Crossing 2004/02/17:Rip Off the Hood of Your Desoto and Send it In arts/books/031126_02.writeback:The War on Copying fitness:This Old Body 2004/03/19:Cajuns and Yellowjackets
The unqualified main page is currently titled “One and Done”, and has the empty prefix (the second line). You note that this also includes even the subpages that come from query parameters, such as the recent writeback view, which is keyed by the parameter string “?recent=7″. By doing this simple change, it changed from being a marginal plugin that is fragile and only somewhat useful to being a cool thing that is generally applicable and much more useful. I do believe that this will even supercede a few plugins, by doing the same thing as the “story_title” plugin, for example. What that plugin does is automatically covered by this one.
The updated page_titler is working on this blog currently. I’m going to wait a little while just to make sure there isn’t some lingering bug, and then make the version 0.2 available for download. I’ll post announcements of this fact to the blosxom mailing list and ping the plugin registry. If you use it, give me some feedback on it please!