June 17, 2005 16:30 | Social / URLs / WebBlogging / WebTech

Del.icio.us hash

A month ago, joshua mentioned an easy breezy little addition one can do to one's site to allow users to easily del.icio.us bookmark entries on one's weblog.

In some cases though, you might like an easy way to see how many people, and who, has bookmarked an entry on your weblog.

But how!?

Del.icio.us hash, my friends, del.icio.us hash.

You know that little "and X other people" link under each del.icio.us entry? Click on it. See that string of weird string characters in the query string? That's an MD5 hash of the bookmarked URL.

What follows is the list of ideas -in sequence of how they came to me and I dismissed them - of how this could be implemented, and why each can't or shouldn't be. The last one is the best bet. I couldn't do any of these myself, except for one, since I can't code to save my life.

1- MT Plugin run from CRON
Hashes every permalink and checks it against del.icio.us, grabs the RSS feed for each and caches them "locally", parses them out for stats and outputs the numbers ("25 people think this is delicious!") into the templates via template tags.
The idea is based on Ado's excellent MT-Technorati plugin which does basically the same with Technorati. The problem is that del.icio.us is really really sensitive to "abusive behavior". Send it too many requests too quickly and joshua will hate you. Also, calculating that many MD5 hashes, retrieving that many RSS feeds and parsing them all and rebuilding them, every 10-15 minutes, puts a hella load on your server. Ferget it.

2- A simple MD5 hashed permalink link.
"Click here to see who del.icio.us'ed this entry!" style. No numbers, no fancy getting and parsing. Number of ways to do this, server side.
a) If you are running PHP you can just add a little call to it's built in MD5 function, feed it your permalink et voila.
<a href="http://del.icio.us/url/<?php md5('<$MTEntryPermalink$>');" title="is it delicious?">is it delicious?</a>
<a href="http://del.icio.us/url/<?php md5('the_permalink();');" title="is it delicious?">is it delicious?</a>

b) Abstract it away with some sort of plugin. In MT, this means that the MD5 hashing occurs at build time and is done by Perl. In WP's case, it's at page request time.

Problem: you have large amount of entries and lots of traffic. Every page request launches an MD5 hash request. System resources-wise, your server needs this like a hole in the head.

3- Client-side, Javascript baby!
Ohhh this could work. A simple JS function included in the header, called from the link:
<a href="#" title="is it delicious?" onclick="do_md5_link('<$MTEntryPermalink$>');">is it delicious?</a>
(any number of ways)

4- Client-side, AJAX/ScrumJAX baby!!!
Basically, do number one above but inline, in real time. On click, MD5 the URL, query del.ico.us for the RSS for the bookmarks of that URL, parse it out, pop a layer showing the number of hits and, whatever, say, the list of users who bookmarked it.

Any takers?

[thanks to Aaron for the hash and calling me a lazy pig-fucker.]