Search code examples
searchgoogle-searchschema.orggoogle-rich-snippetsjson-ld

Google sitelinks search box snippet doesn't work


I'm trying to implement the snippet for the sitelinks search box on Google, according to the documentation in https://developers.google.com/webmasters/richsnippets/sitelinkssearch.

My implementation is the following:

<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "http://www.petmd.com/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "http://www.petmd.com/search?Q={Q}",
     "query-input": "required name=Q"
   }
}
</script>

The target works if you replace {Q} by a keyword and the name of the search field is "Q". Is there something wrong with this implementation?

I've put the code inside the body tag, at the bottom of the page.


Solution

  • I noticed this is now working for petmd.com so, unless you changed anything, I suspect you just didn't give it long enough for Google to pick this up.

    To give some idea of the time frames involved for anyone else looking for this I'll note my experiences below (note this will change depending on the size of your site):

    I added a snippet similar to above to the home page of my website. I used "Fetch as Google" on Google Web Master Tools to submit the home page to Google again to try to force it to recrawl ASAP.

    Within a few days I saw the snippet on Google Webmaster Tools in Search Appearance->Structured Data and clicking on it showed all the data was picked up correctly so all looked good but the Sitelinks Search Box on the Google Results box still was used locally in Google rather than via my website.

    It took a further 3 and a half weeks for the Sitelinks Search Box on the Google Results box to redirect to my site's search page.

    So you just have to be patient when adding this as it can take a few weeks. Note after it's updated there is no visible change to the search results or Google Web Master Tools so you just have to keep trying a test search to see if it's updated to point to your website yet.