Cinan's world

GNU/Linux & free software, howtos, web development, scripts and other geek stuff

Add OpenSearch to Your Site

I’m a content Chromium user. One of the most used functions I use every day is searching from address bar (aka omnibox). You know, start writing site’s name, press tab and type search query. How to make this working on your site? Just two things.

Add a line to the <head> section:

<link rel="search" type="application/opensearchdescription+xml" title="Cinan's world" href="http://blog.cinan.sk/opensearch.xml">

Of course, change title and href as you need.

Create new file opensearch.xml in the root of your site. Paste there a few lines:

1
2
3
4
5
6
7
8
9
10
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
  <ShortName>Cinan's World</ShortName>
  <LongName>Cinan's World</LongName>
  <Description>Search in Cinan's World</Description>
  <InputEncoding>UTF-8</InputEncoding>
  <OutputEncoding>UTF-8</OutputEncoding>
  <Image height="16" width="16" type="image/x-icon">http://blog.cinan.sk/favicon.ico</Image>
  <Url type="text/html" method="GET" template="https://www.google.com/search?q=site:blog.cinan.sk {searchTerms}"/>
  <Query role="example" searchTerms="server"/>
</OpenSearchDescription>

Change names, favicon path and url path as you need. That’s all.

Comments