Simon Dickson, principal consultant at Puffbox, writes stuff about e-government, online news and politics. Some important people read it.

‘Linking here’ lists with Google feed API

8 July 2008 7 , , ,

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).

  • Isn't working in Opera here, I'm afraid (but all the examples on Google's site do).

  • 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.

  • 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 :)

  • 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.

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

  • I've done the decent thing!

  • [...] ‘Linking here’ lists with Google feed API [Puffbox] [...]

Got something to say? Say it.

Stop wasting your time RSS feed

Let us tell you when there's new stuff to read at puffbox.com, by subscribing to the RSS feed.

Go on, show your face

If you want your photo to appear beside any comments you leave here, hop over to Gravatar and upload a picture of yourself. Otherwise, we'll just assume the machine-generated monster is a fair likeness.

Tag cloud

Puffbox.com archives

Search

Alan's comments feed

By popular demand: the comments feed

Ancient history

For posts during 2006 or 2007, Simon's old blog's archives are still available.