Sitelinks Search Box
With Google sitelinks search box, people can reach your content more quickly from search results. Search users sometimes use navigational queries—typing in the brand name or URL of a known site—only to do a more detailed query once on that site. For example, suppose someone wants to find that video about the guilty dog on YouTube. They type YouTube, or you-tube, or youtube.com into Google Search, follow the link to YouTube, and then actually search for the dog video.
The sitelinks search box removes that extra step: a query for youtube displays a site search box in the sitelinks section, letting the user immediately search for that guilty dog video without having to click through to the site first.
How do you set it up?
Sitelinks search box setup involves the following general steps:
- Install a working search engine on your
site.
Queries from the sitelinks search box direct the user to the search results page on your site, so you'll need to have a functioning search engine in order to enable this feature.
No search engine for your site? You can set one up with Google Custom Search Engine.
- Put the schema.org markup on
your homepage.
This markup should reference the URL pattern for your site's search queries in thetargetproperty ofSearchAction. The URL pattern must point to the same domain that hosts the content being searched. It must also include a variable name in braces that is a placeholder for the user's search query. In addition, you'll want to make sure that the URL pattern with the placeholder replaced by an actual query yields a valid search results page on your site. The example below shows the markup in JSON-LD:
- Wait for Google Search algorithms to identify your site as a candidate for the new sitelinks search box.
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.example-petstore.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://host.example-petstore.com/search?q={search_term}",
"query-input": "required name=search_term"
}
}
</script>
See Examples below and specifications for details on the properties you'll need to use for your markup.
Recommended Practices
Follow these general guidelines for using the sitelinks search box.
- Site-wide 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.
- Prevent crawling of your site's search results pages with robots.txt. See more in our Webmaster Guidelines.
- Make sure that your server supports UTF-8 character encoding.
- 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 only one URL search pattern for the target. 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.
Examples
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://www.example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://www.example.com/search?q={search_term}",
"query-input": "required name=search_term"
}
}
</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://www.example.com/search?q={search_term}"/>
<input itemprop="query-input" type="text" name="search_term" required/>
<input type="submit"/>
</form>
</div>
Troubleshooting
We expect to have a markup testing tool in the near future. In the meantime, you can use the JSON-LD Playground to validate your JSON-LD syntax, and use a generic microdata validator if you plan to use microdata format.
Sitelinks search box specification
| 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. |
| query-input | PropertyValueSpecification | A property annotation that indicates that the query property
of SearchAction is an input for
completing the action. The name attribute of
query-input must match the variable name that appears
inside braces in the target property of SearchAction.
|