Posted Dec 2, 2005 11:28:05 PM
Want to add a tag cloud to your own site? The easiest way to do this is to run your site on Blosxonomy. Blosxonomy is inspired by Blosxom, but at its core is driven by the principles of folksonomy. Tag clouds are just one of many standard features that Blosxonomy gives you for navigating your site - it also infers relationships between your posts based on how they're tagged, allowing a unique experience in navigating your site!
Alternatively, if you don't want to jump full on into Tags, and are currently a pyBlosxom user, you can download my Folksonomy Plugin for pyBlosxom, which will help get you started quickly with tagging and tag clouds. Once you've gone that far, migrating to Blosxonomy is easy!
Posted Nov 14, 2005 9:55:44 PM
I revisted my tagsearch implementation this evening and realized I could make it both much simpler and much more powerful. I now support queries with mixed and/or syntax. "and" has higher precedence - so:
http://www.timfanelli.com/tags/python/folksonomy+ruby/blosxonomy
Will return all posts the are tagged ( "python" and "folksonomy" ) or ( "ruby" and "blosxonomy" )
This is accomplished by taking the request string that matches /^\/tags/(.*)/ and splitting it
first on +. I then take each element in the resulting array, split on / and find entries
that match all the tags. The results are appended together to build the final response.
This is all accomplished in a few simple lines:
m = Regexp::compile( config['tags_path'] + "/(.*)", Regexp::IGNORECASE ).match( pathinfo )
if m
ortags = m[1].split('+')
ortags.each { |andtags| app['entries'] |= fel.getEntriesWithAllTags( andtags.split('/') ) }
end
Where fel is my File Entry Locator. I envision this changing a little bit when I design the
SQL Entry Locator, and supporting queries directly in the locator API.
Again, this feature will be released with Blosxonomy 0.6.
Posted Nov 14, 2005 12:14:22 PM
I enabled multi tag searching today in Blosxonomy. This is a feature that was already in place, but my URL processing didn't account for. Multi tag searching allows you to lookup entries that match any or all tags specified in the query string - for instance:
http://www.timfanelli.com/tags/svn/apple
Will lookup all entries that are tagged "svn" and "apple".
http://www.timfanelli.com/tags/svn+apple
Will lookup all entries that are tagged "svn" or "apple".
This opens up the possibility to do some cool things, such as showing a "related tag cloud" instead of the full tagcloud when you're searching on a tag. Clicking on a tag in the related tag cloud could append the new tag as an and or an or, allowing to your refine your results with a dynamic view of available relationships.
This feature will be relesed with blosxonomy 0.6.
Posted Oct 30, 2005 3:23:00 PM
I wrote a quick plugin this morning to generate links to related books (or other items) at Amazon.com using Amazon's Web Services (AWS), based on your entry's tags.
The plugin queries AWS's ItemSearch for each tag in an entry, and then sorts out the results in decreasing order of how many tags a product was returned in. Links are then generated using Amazon's product images for the top N results, where N is some configurable number of products. All the links are generated using your own Amazon Associates ID as well.
You can download it here
From the plugin documentation:
Uses your Amazon Web Services account to query products related to your Folksonomy Tags. This plugin does not require Folksonomy, however if you are using Folksonomy, please get the latest version of it, as there were some potential conlicts over the 'tags' metadata entry. Obtains a REST response from the following URL: http://webservices.amazon.com/onca/xml?Service=AWSECommerceService &AWSAccessKeyId=config['aws_access_key'] &AssociateTag=config['aws_associates_id'] &SearchIndex=config['aws_product_type'] &Operation=ItemSearch &Keywords=&Availability=Available &Merchant=Amazon [&Publisher=config['aws_favorite_pub']] Specify your AWS Access Key and the type of product to search for in your config.py, like so (defaults are as shown here): # Your AWS Access key py['aws_access_key']= # Your Amazon Associates ID py['aws_associates_id']= # The type of product to search on. py['aws_product_type']=Books # Restricts selections to a particular publisher py['aws_favorite_pub']= # The number of books to show on a page. py['story_product_count']=4 # The size of the amazon img to retrieve py['aws_image_size']="MediumImage"" aws_image_size can be one of: SmallImage MediumImage LargeImage I like to use MediumImage and then scale it down using CSS. The SmallImage returns a very low-res picture from Amazon, and is useful if you don't have a lot of bandwidth. aws_product_type and aws_favorite_pub can be overridden on a per-story basis by defining metadata with the same key name in your story. So for instance, if your config.py specifies an aws_product_type of "Books", but you just posted about DVDs, you could override this setting for your story by doing: My Post on DVDs #tags batman,superman,mighty mouse #aws_product_type DVD <p>DVDs are awesome.</p> Valid aws_product_type values are [ "Books","Music","DVD","Toys","Video Games","Software", "Software Video Games","Electronics","Tools", "Sporting Goods","Art Supplies","Kitchen","Gourmet Food", "Apparel","PC Hardware","VHS" ] aws_product_type defautls to "Books" Populates a varaible $relatedproducts for use in your story template, that will contain HTML like: <div id="relatedproducts"> <a class="productlink" href="product url"> <img class="productimg" src="product img"/> </a> <a class="productlink" href="product url"> <img class="productimg" src="product img"/> </a> </div> If you do not want to generate related products for a particular entry, add a "noproducts" metadata entry: My Entry with No Products #noproducts
Posted Oct 29, 2005 1:49:00 PM
Folksonomy 1.2 is avaialble for download
Folksonomy is a pyBlosxom plugin that infers relationships between your blog entries based on tags; providing links to related stories, links to related tags, a tag cloud, and the ability to search for entries by tag.
What's New: As of Folksonomy 1.2, there are no longer any dependencies on other plugins. Folksonomy is now a complete tagging solution for pyBlosxom. If you're already using Tags or Tag Cloud, simple replace those plugins with Folksonomy, and you'll still have all the same functionality you had before!
Folksonomy Quick Guide:
Configuration
Add the following entries to your config.py:
py['pretext'] = "<div class="tags">Tags:"" py['posttext'] = "</div>" py['tagsep'] = ", " #py['tag_url'] = "http://mysite/tags" # defaults to $base_url/tags #py['tag_url_display'] = "http://mysite/tags" # defaults to tag_url #py['ignore_tags'] = []
pretext, posttext and tagsep will be used to render the $tags variable for your story template. tag_url is the
base url to search for tagged entries. Links to tags will be to the url: $tag_url/
Install Folksonomy
This parts easy, just copy folksonomy.py to your plugins directory, and enable it in your py['load_plugins'] if necessary. If you already have Tags or Tag Cloud installed, you may uninstall those plugins now.
Tag Your Entries
This part could be, as they say in French, the suck. Especially if you have a lot of entries. Tagging a single entry is very easy, just add a line like the following:
#tags tag1,tag2,tag3
Below your entry title. I've created a little helper script that will tag all your entries based on their category just to get you started (BACK UP FIRST, I TAKE NO RESPONSIBILITY FOR LOST OR DAMAGED CONTENTS). My friend Matt used it successfully though.
Set Up Your Templates
Now that everything's tagged, we need to set up your templates to show all the cool stuff. Starting with your story template:
- Add $tags to your story, mine is located just underneath the body. This will show the tags for your entry.
- Add $relatedstories, mine is located at the very bottom of my story template, and I use CSS to make it look nice.
- Add $relatedtags, I don't show this on my blog because I don't think it adds much value, but it's there if you want to use it.
Then your header or footer template for the tagcloud:
- Add $tagcloud or $populartagcloud wherever you like, mine is in my side bar defined in my footer template.
$popular tag cloud is a rebalanced subset of your full $tagcloud -- use this if you have a lot of tags with very few entries. It'll help reduce clutter on your page. I'm currently working to enable a URL that will show the full tag cloud for use with this feature.
Voila!
Your blog should now be folksonomy enabled. Easy, right?
Leave Feedback
I'm very excited about how well Folksonomy has been received so far in the pyBlosxom community, and I fully intend to keep it under active development. Please leave your feedback as comments here, or feel free to email me.
Posted Oct 26, 2005 12:05:56 AM
I published the first release of my Folksonomy plugin tonight. Folksonomy infers relationships between your pyBlosxom entries based on their tags, allowing you to generate lists of related stories for each entry.
I still have a couple items to polish up, and I want to merge my tag_cloud plugin into Folksonomy before I submit it to the pyBlosxom registy, but you can get this first pass here.
Posted Oct 24, 2005 11:34:00 PM
Inspired by Pete, and intrigued by the word Folksonomy, I decided to switch my blog to use tags for organization rather than categories.
The birds-eye difference is minimal, I can have multiple tags per entry, whereas each entry belongs to only a single category. While that doesn't sound very powerful in and of itself, using tags extends your ability to relate posts to each other, creating a more meaningful reading experience for your blog.
Getting started with Tags in pyBlosxom is a two step process:
- Install Joe Topjian's Tags plugin. I've done some work on it lately and submitted my changes to Joe - meanwhile you can find my version of it here.
- Install my Tag Cloud plugin.
Once those are in place, we're ready to start tagging our entries. This can be a pain, because pyBlosxom uses the entry file's last modified date as it's post date. I edited each file by hand on Mac OS X (this will also work on any Unix), using a text editor and the touch command, like so:
Oct 23 17:17:05 2005 about.txt > nano -w about.txt && touch -t 0510231717.05 about.txtThis will retouch the file to its original date immediately after my text editor returns.
To add a tag, simply add a #tags section to your entries metadata, like so:
About Timothy Fanelli #tags about <p>My entry goes here.</p>
Alternatively, you could use the one of the various plugins available for editing pyBlosxom entries, or a plugin that caches files post times instead of using the mtime.
Once you have your entries tagged, you should add the $tags variable to your story template, and add the $tagcloud or $populartagcloud to your flavour template. Mine is in my foot template where I define my sidebar. Simply add one of the two tag cloud variables where you want your tagcloud to appear:
The popular tag is generated by taking tags from the full cloud that would be at least a "medium" weight, recalculates the distribution, and applies new weights to the abbreviated cloud. This is useful if you have a lot of tags with few entries that don't really apply to your blog's main topic. I'm working on an extension to the plugin that will allow you to show the full cloud as an entry, check back for updates soon!
Once you have this in place, you're all but done! Your blog now has full tag support, in addition to your regular category structure.
I've gone one step further on my blog and eliminated my category structure all together. I did t his by moving all my entries into a single category called "item". I then used apache's mod_rewrite to redirect requests for categories to the closest appropriate tags, and to redirect my old permalinks to the entry's new home in the item category - here's a sample of my rewrite rule section of my httpd.conf:
RewriteEngine on RewriteRule ^/blog/linux/?$ /tags/linux [R=301] RewriteRule ^/blog/windows/?$ /tags/windows [R=301] RewriteRule ^/blog/xml/?$ /tags/xml [R=301] RewriteRule ^/blog/linux/(.+$ /blog/item/$1 [R=301] RewriteRule ^/blog/windows/(.+)$ /blog/item/$1 [R=301] RewriteRule ^/blog/xml/(.+)$ /blog/item/$1 [R=301]
So any request to http://www.timfanelli.com/blog/linux (my old linux category), will redirect to http://www.timfanelli.com/tags/linux (my new linux tag). If I had an entry under linux named "my_entry", then the old permalink of http://www.timfanelli.com/blog/linux/my_entry.html now redirects to http://www.timfanelli.com/blog/item/my_entry.html.
Posted Oct 23, 2005 10:33:00 AM
Last night my Tag Cloud Plugin was posted in the pyBlosxom plugin registry!
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!
add to del.icio.us