« About a Girl (, Wearing Glasses) | Main | Twittering via E-mail »

MT Plugin to Attach Bookmark Counts on Delicious

To attach counts which indicate how many people bookmarked my entries to del.icio.us, I wrote a tiny plugin script pasted below. I'm sure that anyone must have written a script like it yet, but it's probably much faster to write it for myself than to google for it.

delicious-count.pl

use strict;
use Digest::MD5 ();
use MT::Template::Context;

MT::Template::Context->add_tag(DeliciousCount => sub {
    my $ctx  = shift;
    my $link = $ctx->stash('entry') ? $ctx->stash('entry')->permalink
                                : $ctx->stash('blog')->site_url;
    my $digested = Digest::MD5::md5_hex($link);

    return qq{<a href="http://del.icio.us/url/$digested"><img src="http://del.icio.us/feeds/img/savedcount/$digested?aggregate"></a>};
});

1;

About

This page contains a single entry from the blog posted on April 11, 2007 7:20 PM.

The previous post in this blog was About a Girl (, Wearing Glasses).

The next post in this blog is Twittering via E-mail.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34