---
layout: post
title: "Add OpenSearch to your site"
date: 2013-06-21 20:48
comments: true
categories: [webdev]
cover: /images/cover/avatar.png
keywords: openseach, browser, search, xml
description: Search in a site faster
---

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:

{% codeblock lang:xml%}
<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>
{% endcodeblock %}

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