Creating a Tag Cloud in pyBlosxom

Posted Sat, 22 Oct 2005

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 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!

Related Books

Code Complete: A Practical Handbook of Software Construction Mastering JSP Custom Tags and Tag Libraries Cocoa(R) Programming for Mac(R) OS X (3rd Edition) Learning Python, 3rd Edition C Programming Language (2nd Edition) (Prentice Hall Software)

Comments

On June 22, 2008 at 07:16 PM chombee wrote:

"To use the cloud, simply add somewhere to your head or foot templates."

Simply add what exactly? I had to read through your code to figure that it's $tagcloud that you have to add to the template.

Otherwise, great plugin, thanks!

Post a Comment




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