Friday, August 29, 2014

Adding opensearch to your site

What is Opensearch?

Opensearch allows you to specify how queries are formed when searching a website. You can read the documentation at

How to install it?

This is how I have achieve it on my site

First add a autodiscovery link to your site pages

<link rel="search" type="application/opensearchdescription+xml" title="Rabin's blog" href="/opensearch.xml"/>

Next you need to define the open search document which will be in /opensearch.xml file in your website

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="" xmlns:moz="">
<ShortName>Rabin's Blog</ShortName>
<Description>Search Rabin's Blog: </Description>
<Image width="16" height="16" type="image/x-icon"></Image>
<Url type="text/html" method="get" template="{searchTerms}&amp;submit=Search"></Url>

That’s it. The next time you have loaded the page, you should be able to search your site by pressing tab on Chrome.

Happy coding!

via Rabin's blog

No comments: