Technorati tags, the easy way3

Posted by Bru January 15, 2005 4:05 PM

Was thinking about the technorati tags stuff over and over, it really caught me :)

Anyway, suddenly I remembered reading a post, last summer, by that crazy old adventurer wrapped in journalist clothes that is Ben Hammersley, where he announced quitting categories and moving to del.icio.us like tags in his own weblog...
The code is really simple, and can be adapted easily to manage Technorati tagging.
The only pre-requisite is Brad Choate's perlscript plugin for movable type.

Here's an adaptation of the code, you should be able to adapt it to your astethic tastes by tweaking the print lines.
To make it work, put this code in your templates, then add any keyword you like to your posts and that's it:

<!-- Technorati Tags -->
<MTPerlScript>
my $keywords = "<$MTEntryKeywords$>";
if ($keywords eq "") { 
   print "<!-- No Tags to print out //-->;
} else {
   my @split_keywords = split(/ /, $keywords);
   my $split_keyword;
   print ' | Tags: '; 
   foreach $split_keyword (@split_keywords) {
      print ' <a href="http://technorati.com/tag/'.
      $split_keyword.
      '" rel="tag">'.$split_keyword.'</a> ';
   }
}
</MTPerlScript>

Oh, just another thing. If you use the integrated web editor, the keyword field is not displayed by default. You have to click on “customize the display of this page” (bottom left), check the custom option and then select all the fields you're interested in, including keywords.

And if you are a wordpress fan, well, you can either go and get the fresh TechnoTag plugin, or maybe do an hack like the one above using the get-custom-field-values plugin, adding a custom field with the key “ttags” to your posts and including the following lines in your templates. This should do the trick.

$technoratistring = c2c_get_custom('ttags', '', '', '', ',');
if ($technoratistring) { 
   echo 'Technorati Tags: ';
   $ttags = split(",",$technoratistring);
   foreach ($ttags as $ttag) {
      echo "<a href=\"http://technorati.com/tag/".
      $ttag."\" rel=\"tag\">".$ttag."</a>";
   }
}

Update: Zuppah in a comment points to a bookmarklet that helps in building the custom html code for technorati tags.
I mangled a little bit with it in order to make a customized version for Blogger.com, even more simple one:
this Technorati Bloggerlet will automatically insert the generated custom code at the bottom of your blogger.com post!
Update II: Ups, looks like I wasn't the first to think about this trick...

TrackBacks

Use the following link to trackback from your own site:
http://bru.bzaar.net/mt/mt-tb.fcgi/326


  1. Social Content Tags for Custom Feeds From Reflexive-BlogJanuary 15, 2005 8:04 PM

    del.icio.us allows anyone to add tagged bookmarks and to share them publicly.
    Also, anyone can subscribe to a tag specific

Comments

Leave a response

  1. zuppah January 15, 2005 10:11 PM

    just to add a link for wp solutions... http://oddiophile.com/index.php?p=29

  2. zuppah January 15, 2005 11:55 PM

    silly zuppah... not a wp solution but a generic one :-| sorry bru! too much study and no
    play makes zuppah... :)

  3. john January 16, 2005 1:56 PM

    Thanks for the link Bru. Since I always have keywords in my entries I didn't include Ben's check for no keywords, so your solution is a little more complete than mine. Although in hindsite I'll probably throw that check in there anyway since I could always forget to enter one...

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)