3

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.

unor
  • 92,415
  • 26
  • 211
  • 360

2 Answers2

2

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.

Barry Pollard
  • 40,655
  • 7
  • 76
  • 92
  • 1
    Yes, it's now working. I really didn't know it would take so long. Thank you. – Thiago Ricardo Seely Jan 09 '15 at 11:55
  • Hi BazzaDP! I have a question regarding this: Is `name=Q` required for all the pages to have in their `` tags search html code? Or does placing the json-ld code on the `/index.html`, transfer it to all the pages? – mk117 Jan 11 '15 at 12:51
  • Only required in home page. https://developers.google.com/webmasters/richsnippets/sitelinkssearch. Note the above snippet is completely separate to your search form input field on your site. It's just a way of telling Google to use your search page for in search result searches. – Barry Pollard Jan 11 '15 at 12:54
0

Seems to be correct. However, Google decides if and when to show their Sitelinks Search Box for your site.

Note that there is no need to place it at the bottom of the page, as you use the script element as data block, not as dynamic script (i.e., for JavaScript).

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • The thing is that the sitelinks search appears for my site, but when searching something on the sitelinks search field, I get to Google's page instead of my site's search results. I.E. Just search for "petMD" on Google and the result will appear with the sitelinks search box. – Thiago Ricardo Seely Dec 23 '14 at 11:49