19 March 2007

Search your blog from Firefox

A hack to start this lovely week off! Well, not a hack really. You can call this a Native Blog Search for Firefox, without the AJAX :P Steve’s post about adding microformats in your blog gave me the idea (a little late though) about ways in which we can integrate our blogs with Firefox. The various new features in 2.0 make playing around with them a lot of fun :)

Firefox 2.0 supports Open Search, and when detected, it automatically highlights the search box button, and from the drop down list, you can add the newly discovered search. You would have seen it on Wikipedia, or Live.com … and now here, on this page!

You want it?

Add this one itsy bitsy line to your <head> area:

<link href='http://phpplay.ning.com/Open Search/openSearch.php?blogurl=blog_url&name=blog_name&icon=url_to_icon' rel='search' title='blog_name' type='application/opensearchdescription+xml'/>

Replace the parts in green with the respective details. Note that the blog URL has to be just your blog URL, without the trailing slash. For eg: http://lastword.blogspot.com—nothing more.

After note

While this is a cool thing to have, and gives your readers a faster way to search your blog for anything they want, there is a stupid side effect of this. Searching through this won’t add to your Search Suggest pool. This makes the Search Suggest slightly useless, but hey! I’m all for options :P I plan to fix this in the future though. Will give me something to do when I really don’t have anything else ;)

Search away! :P


2 comments

Singpolyma said...

This is way cool! Why didn't I think of it? ;P

You could add support for suggest into the OpenSearch (it supports it and so does Firefox). If you want suggests added each time someone searches you could proxy-redirect them. That is, searching from the Firefox bar could send them to a page on Ning which would log the search query and then redirect them to the actual blog search page transparently :)

Aditya said...

Why didn't I think of it?

‘Cuz you gotta leave some of ‘ for the rest of us ;) Hehe!

I can add the search suggest, I know. But I'll have to change the output from the existing method, or make another script to specifically give an output for this. It'll take some time, and I have exams, so after that! (Or like I said, when I ‘really’ have nothing to do :P)

And the proxying idea did strike me, but it'll increase time taken to reach the blog itself. I want to come up with something else. Maybe add an automatic fire on detecting a search query on the blog itself?