Related according to the Google API

Doc Searls, Sam Ruby, and Jonathan Peterson are all pointing at Dave Sifry’s Google API hack for Moveable Type.

Sifry writes: “Look down at the bottom of this blog entry. You’ll see a line that starts, ‘Related Stories:’ followed by 10 links. These links are created by a google search on the words in the title of this blog entry.”

It turns out that this is pretty easy to do in Radio as well. As a test, I created a macro called googleTitleSearch, which you can drop in your Macros folder. With the addition of a snippet of code to my item template, I now have the top 10 Google results for the title of my weblog posts.

If you want to try it out, here’s how:

Note: You must first create an account with Google, and configure Radio to use the key associated with your account. Follow steps 3 and 4a on this page to get your key.

If you want something simpler that doesn’t require signing up with Google, you might try out the googleIt macro.

1) Download googleTitleSearch.txt to your Macros folder. (It’s a sub-folder of your Radio UserLand program folder.)

2) Edit your item template, adding the following macro to the template, where you want the search results to appear:

<%local (adrpost = @weblogData.posts.["<%paddedItemNum%>"]); return (googleTitleSearch (adrpost))%>

(Be careful to make sure that the macro appears on a single line in your template. Line-breaks in the macro will cause an error on your page.)

3) Make sure that the preference for Item-level Title and Link is checked.

4) Create a new post, with a title. Click the Post button.

That’s it. For any posts that have a title, you’ll get a Google search result for the words in the title, along with your post.