Google sitelink search box [closed]

a 夏天 提交于 2019-12-23 06:20:06

问题


We are implementing search box within the search result in Google for our site. We have our own search feature on website, and dont want to use Google custom search.

We are following instructions on the following page, but finding it difficult to set it up. Google developer site.

I added the following JSON-LD in the head, but it is not working

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

I was wondering if I set up the code correctly?


回答1:


There is one possible error with your syntax, which is that you are missing a last closing bracket. Your script is also not closed properly as well. I'm guessing it is possible both of these issues could be from copying into SO.

For good measure, it should look like:

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

After that, can you confirm the following:

  1. http://www.oursite.com.au/search.aspx?keyword=test would successfully perform a search on your site for the term "test"? Per the spec does that search sit on the same domain you have the code on?
  2. Have you allowed your site enough time to index after making these changes?


来源:https://stackoverflow.com/questions/25754392/google-sitelink-search-box

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