How to add auto open search document to website

Most of the website has their own search engine by using that any one can search documents on website. Open search is description is set of formats to describe website search engine. By using those document web search client application’s can search website.

OpenSearch description document is one the description document which is used to describe your search page and using this document in page head meta tad we can provide auto discovery of website search page.

OpenSearch description document is an xml document in which you need to provide all required information. Here is example of this document.


  1. Short name of website e.g. code4copy
  2. Description of website
  3. URL of favicon image of your website
  4. Web site search page URL with query string format e.g. ?q={searchTerms}
  5. Website rss search URL with query string e.g. q={searchTerms}

Here is my website Open search description document

<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="">
  <Description>Code snippets examples of java, c#, javascript and more</Description>
  <Image height="16" width="16" type="image/"></Image>
  <Url type="text/html" template="{searchTerms}" />
  <Url type="application/rss+xml" template="{searchTerms}" />

Put this xml in your website(at root or any other accessible location) with name opensearch.xml or what any other you prefer.

By using this document search client application can you user website search page(engine).

We can add auto discovery of this document by adding meta tag in web pages head. This meta tag can be written to all pages or default page of website.


<link type="application/opensearchdescription+xml" rel="search" title="code4copy" href= />

Your website OpenSearch provider is read, you can verify this by using Google Chrome web browser. Just type you website domain and press space key, this we change Chrome address bar to search engine of your website as shown below.