Technorati Cosmos Links Display for WordPress

Friday, August 17, 2007

Sometimes when I write an article I know that there is a low potential value for comments directly on the article. In these cases, I close comments and encourage linking to the article from other sites, hoping to encourage more thoughtful replies and a richer discourse. Well that’s great, but it’s not much of a discourse if you can’t read both sides.

I needed a simple way to list links back to my posts. Technorati is pretty much the de facto place to go for blog post linking, so I figured I’d check out their API. About 90 minutes later I have a working script that I just include inside of my WordPress theme file:

include 'technorati.php';

I figured other people might have a similar desire or might just be in search of an actual implementation of a Technorati API client in PHP, as their documentation pretty much sucks.

Here’s the source of my quick script: technorati.phps.

You can see the script in action on one of my more controversial posts, like this one. Scroll down just past the article, before the comments and see the “Links to this post” section.

The script is fairly simple, but has a few niceties. First it queries the Technorati API passing in the current post’s URL to get a list of links (if any). Then it gathers info about each link, sorts them by “rank” (number of inbound links to the site in question), removes duplicates (by site name and by URL), and finally displays the list.

Here’s a shot of what it looks like on the aforementioned post:

A view of the links to the post mentioned

The script is by no means a stellar example of PHP code, nor is it as pretty/fast/whatever as it could be. This was just me hammering something out to get some link love displayed on my posts. I’m reasonably satisfied for under two hours of work, though. I might think about packaging this up as a WordPress plugin if there’s enough demand, but I’m spent for now.

written by Brad Fults

Archived at: http://h3h.net/2007/08/technorati-cosmos-links-display-for-wordpress/

Comments are closed for this post. Please contribute to the discussion by posting your own article and linking back to this one.