Google sitelinks search box snippet doesn't work

喜夏-厌秋 提交于 2019-12-13 14:52:57

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/27571635/google-sitelinks-search-box-snippet-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!