Adding Sitelinks Search Box Markup to Your Site

Lizzie Alden On Page SEO, Organic Search 1 Comment

What is the sitelinks search box?

You may have noticed the appearance of a search box within listings on Google, particularly for branded terms. These are shown for certain sites and brands where Google has determined that the search box would be relevant for users. By default, this box leads the user to a second Google search using the “site:” operator. However, there is markup available that would cut out the second Google search, and send users directly to your internal site search. In general, the fewer steps it takes to get to your site, the better.

sitelink search

Is my site eligible for the sitelinks search box?

You can find out if your site is eligible in two ways:

  1. Perform a branded search for your site – if it doesn’t show up right away, try a few different variations.
  2. Check Google Webmaster Tools – Some webmasters have been sent messages letting them know if their site is eligible.

How can I send users directly to internal search results?

  1. If you haven’t done so already, set up internal search on your site. (If you don’t have one set up, Google Custom Search is one solution).
  2. Make sure you have a preferred version of your homepage set up. Many sites have multiple homepage variations, such as ‘www.example.com’ ‘www.example.com/index’ and ‘www.example.com/’.  Choose one of these variations as your preferred version, and canonicalize all other versions.
  3. Add the code to your homepage in JSON-LD or Microdata format (we used JSON-LD):
  • JSON-LD – This code snippet can go anywhere on your homepage. We chose to put it in the body section, but it could go in the header or footer as well.

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

Replace https://www.example.com/ with your site’s preferred homepage URL. Replace  https://query.example.com/search?q= with your site’s  search query string. *

*To find the search query string,  perform a test search on your internal search. The search query string is everything in the destination URL prior to the search term.

For: https://www.example.com/Search-Results.aspx?searchtext=SEARCHTERM

The search query string would be https://www.example.com /Search-Results.aspx?searchtext=

  • Microdata: This code snippet would be placed around the search box on your homepage.

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

Replace https://www.example.com/ with your site’s preferred homepage URL. Replace  https://query.example.com/search?q= with your site’s  search query string. *

Once the code is implemented, it can take some time for Google to start sending users through to your internal search (It took 1-2 weeks in this case).  If you want to make sure your code is set up correctly, you can use Google’s Structured Data Testing Tool.  For more information and troubleshooting, visit the Google Developers Page on the Sitelinks Search Box.

Lizzie AldenAdding Sitelinks Search Box Markup to Your Site

Comments 1

Leave a Reply

Your email address will not be published. Required fields are marked *