'Linking here' lists with Google feed API

Time for some tech talk. A few weeks back, I wrote about Google’s new AJAX Feed API. Having played with it last week on behalf of a client, and having liked what I saw, I decided to implement it myself.
If you’re reading this on the puffbox.com website itself, you might see a list in the sidebar headed ‘Who’s linking here?’. (If not, see here for an example.) It’s something I introduced a while back, powered by feeds from Google’s Blogsearch engine, and processed using the excellent SimplePie. But I’ve now switched over to doing it client-side, through the Google API.
Once the blog post finishes loading, the Javascript calls in the RSS feed (actually, it’s Atom format) from Google. If it finds any blogs linking to that specific post, it writes a title into one previously empty DIV, and a disclaimer into another. In between, it generates up to 10 <LI> list items, each active as a link to the linking blog.
If you want to see how it’s done, and copy the idea for yourself, a quick glance at the page’s source code will reveal how straightforward it was. (You’ll need your own API key, obviously.)
Why go client-side? It’s less effort for the server to process; and it doesn’t build up a mass of cached feeds. It should also be marginally more secure on paper, which is important to some clients. And whilst the function is dependent on Javascript being available, it’s dead easy to offer a ‘noscript’ alternative – a link to a pre-formatted Google search query. It’s nowhere near as slick, but it ensures the information is still available to those without Javascript, so it passes accessibility requirements (W3C guidelines, checkpoints 6.3 and 11.4).

7 thoughts on “'Linking here' lists with Google feed API”

  1. Thanks Matthew… my mistake. The puffbox.com page template never actually defined a <head> tag! I’m clearly an idiot. Now it’s fixed, Opera’s happy.

  2. Interesting — I’m using a Bloglines search to do this at TellThemWhatYouThink. I may have to plug the same query into both and see which one returns better results 🙂

  3. Would be interested to hear the conclusions of any such test, Harry. But my guess is, Google’s Blogsearch will be much, much faster. I still use Bloglines as my RSS reader of choice, but I’m aware that it can often take quite some time for new material to register. Meanwhile, Google’s indexing seems pretty close to real time.

  4. PS: Could somebody please do the decent thing, and link to this posting… if only to have an example on the same page?

Comments are closed.