Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let Google detect a site search engine?

Tags:

Google Chrome has a feature where you can hit tab to search a site. Chrome then navigates to the site's own search engine and runs the inputted query. The Chrome documentation indicates that this is only available if Google has detected a search engine on the site you are trying to search.

This indeed seams to be the case, because writing stackoverflow.com<Tab>test<Enter> makes Chrome navigate here while facebook.com<Tab>test<Enter> does nothing because the tab-key tabbes out of the address line.

What I'm wondering is then how to indicate to Google that my site has a search engine and how Google needs to format a query in order to redirect a Chrome user correctly to my site when the tab-search feature is utilised. Is it a Meta tag? Is it in robots.txt?

like image 919
Andreas Hagen Avatar asked Dec 29 '12 14:12

Andreas Hagen


People also ask

How do I get Google to recognize my search engine?

In the top right corner of the browser, click the Tools icon. Click Internet options. In the General tab, find the "Search" section and click Settings. Select Google.


1 Answers

After a little digging I found this page that describes this. Also you can read in Stackoverflow's source code and find this line of code:

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

What it does is indicate to Google that the description for how to use your search engine in the file /opensearch.xml which contains this:

<?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> 
like image 103
Andreas Hagen Avatar answered Sep 30 '22 06:09

Andreas Hagen