Pages

Monday, 25 September 2006

Blogger: Google Map, Video etc search via hyperlinks in your posts






If you've not seen it yet, Mark Lucovsky has come up with a neat way to have, in your blog's sidebar, search forms for places via Google Maps and videos on Google Video (plus a Google search which shows the results in the main column of your blog (like Kirk spotted you can get with Blogger Beta).

Not only that, but with his code, you can create hyperlinks in your blog posts which, when clicked, will display the results of a Google Maps or Google Video search in the sidebar (or Google search results in your blog's main column, at the top, with tabs). You have to sign up for a free Google Ajax Search API key which will be unique to your blog URL and tweak and republish your template. Once you've customised your blog template, you just create the links by, instead of inserting the usual a href="http://something" for links, using a href="javascript:doMapSearch('search-term') (or change doMapSearch to doCoreSearch for a Google search whose results appear in your main blog column, or doVideoSearch for a video search).

He's provided examples, with the source for the templates, for both Blogger and Typepad: Blogger example; Typepad example. Here's a screenshot of part of the sidebar from his Blogger example:


Try clicking the example links in his post and doing some searches in the Blogger example to see what it does. You'll see he's only given the template code for old-style Blogger blogs, though I'm sure someone will soon hack it for new Beta blogs. It involves putting Javascript in the head section of your template (plus some styling stuff), and also code in the sidebar section. The clickable links in the sidebar under the Maps and Video search forms again have been added via code in the template.

I haven't had a chance to incorporate any of those searches into my blog yet and I'm not sure I will, well maybe the Google search, as I don't often refer to videos or locations. But it's very neat.

I've also not had time to do a step by step on how to incorporate all this into your blog, if someone else doesn't do it first I may get round to it at some point!

No comments: