Step 3: Add Sitelinks Search Box Schema

Overview

Regardless of whether you choose Approach 1 or Approach 2 to integrate, we recommend that you set up SiteLinks Search Box Schema. This step of the process is optional. Setting this up will allow you to take advantage of a feature from Google that allows you to redirect traffic from Google search onto your own site search (internal search) when a user searches for your brand. It’s called the SiteLinks Search Box and can be triggered based on schema.

Here is an example of BestBuy using it in action:

Sitelinks Search Box Schema in Action

As you can see when a user searches from within the Google SERP, it’s redirecting the user to BestBuy site search!

Implementation

The full documentation on how to tag your site search is provided in Google’s Sitelinks Search box documentation , but we’ve also included a brief summary below.

Note: Your homepage URL should be verified with your relevant SEO stakeholders.

To add this to your website, include the Search Box schema.org markup on your main domain.

In the snippet below you will need to replace two pieces of content:

  • URL (REPLACE_ME_URL) - This is the main domain of your website (e.g. https://www.yourdomain.com)
  • Target (REPLACE_ME_SEARCH_RESULTS_PAGE) - This is the URL for the search results. Note that you should NOT change anything after /?query={search_term_string}. For example a full URL for Yext will look like https://search.yext.com/?query={search_term_string}

Make sure you replace the target URL with the URL of your search results page you created in Step 1.

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

Additionally, you should add a rel="canonical" tag to your homepage, to help Google understand which results should include the search box.

<link rel="canonical" href="https://www.yourdomain.com" />