Creating a Tag Cloud in pyBlosxom

Posted Oct 22, 2005 6:55:00 PM

I installed the tags plugin tonight, and tagged most of the entries on my site. I decided to replace categories all together, and as such, you'll notice a tag cloud on the left side of my site.

I wrote a simple pyBlosxom plugin to generate the tag cloud, to be used in conjunction with the tags plugin. You can download it here: tag cloud plugin.

From the plugin documentation:

tag_cloud.py

Creates a tagcloud to compliment the tags plugin. Simply copy to 
your plugins directory and enable in py['load_plugins'] if 
necessary. The tags plugin must be installed and properly 
configured.

Simply add a #tags tag1[,tag2[...]] to your entry metadata section.

You should then define the following classes:
	.smallestTag
	.smallTag
	.mediumTag
	.bigTag
	.biggestTag

as well as

	#tagcloud

in your CSS to fit your needs.

As of 1.0.1, tag_cloud supports the following config property:
	py[ 'ignore_tags' ] = [ ]

where 'ignore_tags' is a list of tags to ignore while generating 
the tag cloud. This way, if you have a very widely used tag, such 
as "general", which is overwhelming your tag and isn't necessary, 
you can choose to omit it. 

As of 1.0.2, tag_cloud obeys the ignore_directories propery in 
pyblosxom.

To use the cloud, simply add $tagcloud somewhere to your head or foot templates. Mine happens to be in the foot template, because that's where I keep my sidebar code.

Comments, bug reports, and fixes are welcome!

Popular Tags

Recent Stories

${recent.title}

About

My name is Tim Fanelli, I am a software engineer in Northern NY. I spend most of my time working, and when I can, I try to post interesting things here.

Cigar Dossiers