Pages

Thursday, 9 July 2015

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.
Guilty Dog video image




How do you set it up?

Sitelinks search box setup involves the following general steps:
  1. Install a working search engine on your site.
    Sitelinks search queries send the user to your site's search results page, so you need a functioning search engine to power this feature.
  2. Put the schema.org markup on your homepage.
    Your markup should have all the elements shown in the JSON-LD example below:
    <script type="application/ld+json">
    {
       "@context": "http://schema.org",
       "@type": "WebSite",
       "url": "https://www.example-petstore.com/",
       "potentialAction": {
         "@type": "SearchAction",
         "target": "https://query.example-petstore.com/search?q={search_term_string}",
         "query-input": "required name=search_term_string"
       }
    }
    </script>
    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.
      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 thename 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 a valid search results page on your site.
    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.
  3. Wait for Google Search algorithms to identify your site as a candidate for the new Sitelinks search box.
See Examples below and specifications for more details.
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.
    • No changes to robots.txt are necessary for 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.
  • 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 ourWebmaster Central Help Forum.

Examples




<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>

Troubleshooting & Tips

We expect to have a markup testing tool in the near future. In the meantime, you can use the JSON-LD Playgroundto validate your JSON-LD syntax, and use a generic microdata validator if you plan to use microdata format.
In the meantime, make sure your markup passes the following criteria:
  • Using the search URL pattern in the target property, replace the curly braces and all that's inside of it with a search query. Copy and paste this 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 andhttp://www.example-petstore.com/search?q=leashes should both lead to search result pages on your site about "collars" and "leashes."
  • 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.

Sitelinks search box specification

PropertyTypeDescription
urlURLA 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.
potentialActionSearchActionA property of WebSite indicating a supported action a user might take, in this case a search. Learn more about schema.org Actions.
targetEntryPointA property of SearchAction that indicates a method for executing theSearchAction. 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-inputPropertyValueSpecificationA property annotation that indicates that the query property of SearchActionis an input for completing the action. The value for the name attribute of thequery-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.

No comments:

Post a Comment