Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i instruct the google's omnibar the way to do a search for my domain?

What must we do to have Google's omnibar show a custom search for our domain: enter image description here

Like if we go the omnibar and type s-t-a-c-k-o-v-e-r-f-l-o-w-.-c-o-m-[SPACE] the bar will come out, and typing asd in the box for example will take us straight to https://stackoverflow.com/search?q=asd

I've noticed this behavior to be different from that of wikipedia (which takes us to http://en.wikipedia.org/w/index.php?title=Special:Search&search=asd)

The behavior is also different with youtube (which takes us to http://www.youtube.com/results?search_query=asd&page=&utm_source=opensearch)

Well of course not all domains have this behavior, try: g-o-d-a-d-d-y-.-c-o-m-[SPACE] does nothing

How do i instruct the google's omnibar the way to do a search for my domain?

like image 207
Pacerier Avatar asked Jul 19 '11 11:07

Pacerier


1 Answers

It's this line in the <head> of each page:

<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">

And the file it points to:

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">
  <ShortName>Stack Overflow</ShortName>
  <Description>Search Stack Overflow: Q&amp;A for professional and enthusiast programmers</Description>
  <InputEncoding>UTF-8</InputEncoding>
  <Image width="16" height="16" type="image/x-icon">http://sstatic.net/stackoverflow/img/favicon.ico</Image>
  <Url type="text/html" method="get" template="http://stackoverflow.com/search?q={searchTerms}"></Url>
</OpenSearchDescription>

It's called OpenSearch and it's a standard way of specifying how to search your website. See opensearch.org for the specs.

like image 64
Matti Virkkunen Avatar answered Oct 16 '22 05:10

Matti Virkkunen