Define an OpenSearch XML document to describe the search engine of your website

Solution #1

Step 1. Create a open-search.xml file with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="">
    <Description>Lorem Ipsum Dolor Sit Amet.</Description>
    <Url type="text/html" template="{searchTerms}"/>

This XML file has three mandatory elements:

  • ShortName: 16 or fewer characters of plain text.
  • Description: 1024 or fewer characters of plain text.
  • Url: describes how a client (a person, a browser, a search engine) looks for resources on your website. The type and template attributes are required:
    • type: is the MIME type of the returned contents (text/html for web pages).
    • template: is the URL used to search contents on your website. The placeholder {searchTerms} refers to the user's search query (see the OpenSearch URL template syntax).

Step 2. Add a link to that document in every page of your website:

<!-- ... -->
    <!-- ... -->
    <link rel="search" href="/open-search.xml" title="Search"
<!-- ... -->
Solution #2

The OpenSearch Specification defines a detailed XML description document for more complex websites.

Find more solutions about: , , , , , ,