Browse code

New article: Add OpenSearch to Your Site

Cinan Rakosnik authored on 21/06/2013 at 19:07:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+---
1
+layout: post
2
+title: "Add OpenSearch to your site"
3
+date: 2013-06-21 20:48
4
+comments: true
5
+categories: [webdev]
6
+cover: /images/cover/avatar.png
7
+keywords: openseach, browser, search, xml
8
+description: Search in a site faster
9
+---
10
+
11
+I'm a content Chromium user. One of the most used functions I use every day is
12
+searching from address bar (aka omnibox). You know, start writing site's name,
13
+press tab and type search query. How to make this working on your site? Just two things.
14
+
15
+Add a line to the ```<head>``` section:
16
+
17
+```<link rel="search" type="application/opensearchdescription+xml" title="Cinan's world" href="http://blog.cinan.sk/opensearch.xml">```
18
+
19
+Of course, change ```title``` and ```href``` as you need.
20
+
21
+Create new file ```opensearch.xml``` in the root of your site. Paste there a few
22
+lines:
23
+
24
+{% codeblock lang:xml%}
25
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
26
+	<ShortName>Cinan's World</ShortName>
27
+	<LongName>Cinan's World</LongName>
28
+	<Description>Search in Cinan's World</Description>
29
+	<InputEncoding>UTF-8</InputEncoding>
30
+	<OutputEncoding>UTF-8</OutputEncoding>
31
+	<Image height="16" width="16" type="image/x-icon">http://blog.cinan.sk/favicon.ico</Image>
32
+	<Url type="text/html" method="GET" template="https://www.google.com/search?q=site:blog.cinan.sk {searchTerms}"/>
33
+	<Query role="example" searchTerms="server"/>
34
+</OpenSearchDescription>
35
+{% endcodeblock %}
36
+
37
+Change names, favicon path and url path as you need. That's all.