Blosxom TagCloud

A tag cloud is a visual depiction of content tags used on a website. Often, more frequently used tags are depicted in a larger font or otherwise emphasized. Selecting a single tag within a tag cloud will generally lead to a collection of items that are associated with that tag. From the Wikipedia Tag cloud entry.

Ever wanted a tag cloud of your Blosxom posts? With just this blosxom-tagcloud.pl script (and three Perl modules from CPAN) you can have one that integrates itself with your Blosxom footer and even allows easy merging of the tag cloud and any static text/HTML you’ve used in the past.

Overview: blosxom-tagcloud.pl works by scanning a directory tree, the location of which is a config setting, and building a list of all your posts and the categories they are under. Once it’s got this list it uses the HTML::TagCloud module to generate some HTML and CSS for their display. It then tries to merge in any static footer you might be using and creates a footer file that can be included directly in your blog. This isn’t a Blosxom plugin, this script should be run on a periodic basis to save the machine needing to do a file system walk with every blog hit.

Installation: The installation is easy, download the script, if necessary un-compress it, install the required perl modules (File::Find::Rule, IO::AtomicFile and HTML::TagCloud) and then tweak the configuration settings at the top of the script to suit your Blosxom install. The settings are mostly self-explanatory and I’ve left examples in the code.

Notes: I’m undecided on the use of tag clouds in a UI so I thought I’d conduct a little experiment and see how useful they are by adding one to my own blog. The perl script below, blosxom-tagcloud.pl, is what I use to generate the footer that contains the tag cloud; to see an example scroll to the bottom of the UnixDaemon Blog. The script will search a given directory tree for Blosxom posts (they must all have the same file extension) and then write out a footer file, which can include another static file, that will be displayed on your blog.

The script itself is pretty short and uses three main modules, all of which are available on CPAN. Two of the modules, File::Find::Rule and HTML::TagCloud do most of the heavy lifting and are essential. You could probably replace the dependency on IO::AtomicFile quite easily but it’s not really worth the effort.