Sunday, May 07, 2006

Categories for Blogger

If you want to add some topics to your blogger blogs, you'll have to use some tagging provider, like delicious, and then connect your blogger template to it. Don't run away, it's not that hard, and to now it's the only way. There are basically 2 or 3 steps required :
  1. At every post, feed your tagger with the your chosen tags for the entry
  2. potentially including those tags in the entry as well
  3. At Blogger display level, have the tags and the tagged entry to be displayed
The basic concept is that from your tag provider, each blog entry will be tagged with the name of your blog. Then from a blog perspective, we can ask your tag provider to retrieve those entries and display them in blogger.
  • For step 1 and 2 if you use Firefox and Greasemonkey extension, the following script makes it easy to have tags at posting time : Script 2182: Deluxe Script by Johan Sundstrom w/ additional features
  • For step 3, you can use freshtags, which is a bit of javascript code to interrogates delicious and adds the navigation html to your page.
But I wanted more control than just a tag navigation system. I wanted to be able to tags some posts as "sticky", and have a permaent sections to display those. Or may be have some other sections where I collect my "interesting links" items. So I modified the freshtags javascript. If you want to do this, just replace the freshtag javascript file with this one. (Adapt to your delicious user name and your blog tag - the 'anchor') <
<script type="text/javascript">
//FreshTags v0.5
del_user = "nrolland";
anchor = "Structurallyyours";
archive = "";
defs = "";
maxposts = 20;
writeScript( "" );
//writeScript( "" );

function writeScript( src ) { document.write( '<script type="text/javascript" src=" '+ src +' "><\/script>')  }

window.onload = function() {
  displayinelement("list", 20, "catemergence", "emergence+permanent");
  displayinelement("list", 20, "catlearning", "learning+permanent");
  displayinelement("list", 20, "catdiffusion", "diffusion+permanent");
  displayinelement("list", 20, "catproducts", "products+permanent");
  displayinelement("list", 20, "catentrepreneurship", "entrepreneurship+permanent");
  displayinelement("list", 20, "catsoftware", "software+permanent");
This last code tells your browser to fill the HTML element called "catemergence" with the entries tagged "emergence" and "permanent" in delicious. So there need to be somewhere in your template an element called as such, which will be the placeholder of your dynamic content :
<div id="catemergence"             class="permanent">
So now you can easily have many sections which are automatically feed by the tags you provide.


Post a Comment

Links to this post:

Create a Link

<< Home