简体   繁体   English

Google附加链接搜索框

[英]Google sitelink search box

We are implementing search box within the search result in Google for our site. 我们正在Google网站的搜索结果中实现搜索框。 We have our own search feature on website, and dont want to use Google custom search. 我们在网站上拥有自己的搜索功能,并且不想使用Google自定义搜索。

We are following instructions on the following page, but finding it difficult to set it up. 我们遵循下一页上的说明,但是很难进行设置。 Google developer site . Google开发人员网站

I added the following JSON-LD in the head, but it is not working 我在头部添加了以下JSON-LD,但无法正常工作

   <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? 我想知道我是否正确设置了代码?

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. 我猜这两个问题都可能是复制到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"? http://www.oursite.com.au/search.aspx?keyword=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? 进行这些更改后,您是否有足够的时间索引网站?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM