What I like most about the widget is its implementation of unobtrusive DOM scripting techniques. Adding the widget to a page is a case of adding a regular HTML link element with its
rel attribute set to a value of
Looking at the script itself it’s using a tidy object structure to neatly namespace its functions and variables – a practise that’s increasingly becoming essential for multiple scripts to co-exist on pages without stepping on each other’s toes. They seem to have done a good job here making sure that the widget will play nicely with whatever else is in your page.
Anyway, the purpose of this post wasn’t to prattle on about the widget itself, but to note how I implemented it in Textpattern. The widget page gives instructions for Wordpress and a few other blogging tools, but not for TXP. Essentially, all that is needed to implement the widget is the URL of the content item. Textpattern has no standard template tag for getting that – the only available tag returns a block of markup and not just the bare URL. Therefore we need to be just a little hacky. In your post template, replacing the [square braces] with normal angle brackets:
<a href=“http://technorati.com/search/[txp:php] global $thisarticle; echo permlinkurl($thisarticle); [/txp:php]” rel=“linkcount”>View blog reactions</a>
Update: thanks to Robert in the comments for pointing out that from Texpattern 4.0.4, you can simply do this:
<a href=“http://technorati.com/search/[txp:permlink /]” rel=“linkcount”>View blog reactions</a>
You’ll need to have PHP in templates enabled in order for the former to work, but we should all be running at least 4.0.4 anyway. Following that, just drop a script tag linking to the Link Count script into your page and job’s a good’en. I’ve added mine just before the closing body tag, rather than in the head. This is because the Technorati servers often seem really slow to respond, so having the script down there will minimize the negative impact on my site when that happens.
This is working for me in Textpattern 4.0.3 (not quite the newest), let me know if you spot any problems.