Hide

Sitelinks Search Box

With Google Sitelinks search box, from search results. Search users sometimes use navigational queries, typing in the brand name or URL of a known site or app, only to do a more detailed search once they reach their destination. For example, users searching for pizza pins on Pinterest would type Pinterest or pinterest.com into Google Search--either from the Google App or from their web browser--then load the site or Android app, and finally search for pizza.

To make content searches easier for your users, add just one markup declaration on your home page, telling the Google crawlers that users can search your site directly from Search results. Once we scan your home page and after users perform relevant navigational queries for your property, the search box appears in results. If you also have an app that corresponds to your website, add another line of markup so that your app users can search their apps directly from a mobile device following a navigational query.

The following illustration shows a navigational query for pinterest from the desktop, which then displays a Sitelinks search box above the sitelinks for Pinterest. The user can search "pizza" directly in Search results to open content in the Pinterest site.

Pinterest Query image

If the user performs that same search on their mobile device and has the Pinterest Android app installed, the Sitelinks search box directly searches and opens content in the Pinterest app instead.

Pinterest App Query image

How do you set it up?

The Sitelinks search box setup involves the following general steps:

  1. Install a working search engine on your web site or Android app.

    Sitelinks search queries send the user to the search results page for your site or app, so you need a functioning search engine to power this feature.

  2. Put the schema.org markup on your homepage.

    Your home page is the only page that requires markup to specify a Sitelinks search box. The JSON-LD examples below show all the elements you need for either a site-only or a site-and-app search box.

  3. Wait for Google Search algorithms to identify your site or app as a candidate for the new Sitelinks search box.

Site only

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.example.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://query.example.com/search?q={search_term_string}",
    "query-input": "required name=search_term_string"
  }
}
</script>

Site + App

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.example.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://query.example.com/search?q={search_term_string}",
    "target": "android-app://com.example/https/www.example.com/search/?q={search_term}"
    "query-input": "required name=search_term_string"
  }
}
  1. url - This property specifies the URL of your website. It must match the canonical URL of your domain's homepage.

  2. potentialAction:target - This property specifies a search URL pattern for sending queries to your site's search engine. You must always specify at least a web-page target, but if you also have an app for which you want to enable deep content searches, specify that target as well.

    Key points about the URL pattern:

    • It must include a string enclosed in curly braces that is a placeholder for the user's search query (e.g., {search_term_string}). The string inside the curly braces must also appear in the name attribute of the query-input property.

    • It must point to the same domain on which the markup is found.

    • An actual query string instead of the placeholder string must produce valid search results from your site or app.

  3. query-input - the value for the name attribute of query-input must match the string enclosed inside curly braces in the target property of potentialAction.

See Examples below and specifications for more details.

Follow these general guidelines for using the Sitelinks search box.

Site configurations

  • Set a preferred canonical URL for your domain's homepage using the rel="canonical" link element on all variants of the homepage. This helps Google Search choose the correct URL for your markup.

  • No changes to your robots.txt file are necessary for the Sitelinks search box to work correctly. Continue to follow our Webmaster Guidelines on this topic.

  • Make sure that your server supports UTF-8 character encoding.

App configurations

  • If you also want navigational queries to work for users who have installed your Android app, make sure to have the proper intent filters to support the URL you specify in the app target of your markup. For an example of how to create intent filters for Search deep links, see the App Indexing Guide for Android.

Markup guidelines

  • Put the markup on the homepage of your site. It is not necessary for the markup to be repeated on other pages of your site.

  • We recommend JSON-LD. Alternatively, you can use microdata.

  • Specify at most only one URL search pattern per platform. We are experimenting with multiple pattern support, so if you have feedback or use cases for multiple target support, let us know in our Webmaster Central Help Forum.

  • Always include a search target for your website, even if the app search target is your most-preferred use case. In this way, if the user is not searching from an Android phone or does not have your Android app installed, the search result will direct to your website.

Markup Examples

JSON-LD

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.example.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://query.example.com/search?q={search_term_string}",
    "query-input": "required name=search_term_string"
  }
}
</script>

Microdata

<div itemscope itemtype="http://schema.org/WebSite">
  <meta itemprop="url" content="https://www.example.com/"/>
  <form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
    <meta itemprop="target" content="https://query.example.com/search?q={search_term_string}"/>
    <input itemprop="query-input" type="text" name="search_term_string" required/>
    <input type="submit"/>
  </form>
</div>

Troubleshooting & Tips

Use the Structured Data Testing Tool to test your markup.

Some timps for validating and testing your markup:

  • Site: Start with the search URL pattern in the target property for your web page. Replace the curly braces and everything inside of it with a search query. Copy this entire string and paste it into a browser to verify that it leads to a valid search results page on your site. For instance, if your target property is http://www.example-petstore.com/search?q={searchTerm}, then http://www.example-petstore.com/search?q=collars and http://www.example-petstore.com/search?q=leashes should both lead to search result pages on your site about "collars" and "leashes."

  • App: Use our deep link testing tool to ensure that a valid query opens up your app with expected search results. Start with the search URL pattern in the target property for your app. Replace the curly braces and everything inside of it with a search query. Copy this entire string into the input box of the testing tool.

  • The value for the name attribute of the query-input property should match the string that's inside the curly braces in the target property.

Property Type Description
url URL A property of WebSite that specifies the URL of the site being searched. The value of this property must match the canonical URL of your domain's homepage.
potentialAction SearchAction A property of WebSite indicating a supported action a user might take, in this case a search. Learn more about schema.org Actions.
target EntryPoint A property of SearchAction that indicates a method for executing the SearchAction. This must be a URL pattern that points to an address on the same domain as the content being searched. It must also include a variable name in braces that is a placeholder for the user's search query. Your server should assume and support UTF-8 values for users' search queries. Your Android app should be able to support an ACTION_VIEW intent from Search results, with the corresponding data URI specified in your markup.
query-input PropertyValueSpecification A property annotation that indicates that the query property of SearchAction is an input for completing the action. The value for the name attribute of the query-input property should match the string that's inside the curly braces in the target property.

To tell Google not to show a Sitelinks search box when your site appears in the search results, add the following meta tag to your homepage:

<meta name="google" content="nositelinkssearchbox" />

The Sitelinks search box will be disabled as part of the normal Googlebot crawling and processing of the page, which can take a few weeks depending on the site and other factors.