How To Implement Google’s Sitelink Search

Google have just released a new update to their search engine, which amongst many changes, now allows some website to display a sitelink search directly below their website in the Search Engine Results Page (serps).

This can only be done if your website allows for internal searching, and is done by implementing the a snipit of code on your websites home page, but there are some prerequisite before proceeding.

  • First, verify you have a functioning site-specific search, which will post the query of the search into the URL bar.
  • Add the below code to the head of your website (homepage only)
  • Set up a canonical URL for your home page

Simply edit your current website’s head (if this is a wordpress website, this will under your website theme folder header.php, or in Magento, this would be under your theme folder header.phtml).

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

You should make sure you only show this on your home page, so it is recommended to check to see if the homepage is the current page being viewed.

You will need to update the sitelink search code above, replacing “https://example.com” and “https://query.example.com” with the domain name of your website, and also check to see if the search query is correct for your website.

Leave a Reply

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