关于生成附加链接搜索框

时间:2019-06-14 08:59:11

标签: google-sitelink-searchbox

我在网站上使用了下面给出的Schema.org代码,但是仍然没有网站链接。

<script type="application/ld+json">
{
 "@context": "https://schema.org/",
 "@type": "WebSite",
 "name": "website-name",
 "url": "https://website-name.com.au",
 "potentialAction": {
   "@type": "SearchAction",
   "target": "https://prabingautam.com.au/?s={search_term_string}",
   "query-input": "required name=search_term_string"
 }
}
</script>

此外,我对于使用哪个query-input来获取站点链接搜索框感到困惑。要么

"query-input": "required name=search_term_string"

"query-input": "required name=searchbox_target"

1 个答案:

答案 0 :(得分:0)

您必须使用与target中的占位符相同的值。

"target": "https://prabingautam.com.au/?s={search_term_string}",
"query-input": "required name=search_term_string"
"target": "https://prabingautam.com.au/?s={searchbox_target}",
"query-input": "required name=searchbox_target"
"target": "https://prabingautam.com.au/?s={foobar}",
"query-input": "required name=foobar"

您可以选择任何喜欢的东西。没有理由不使用search_term_string(此值将在Google’s examples中使用,因此复制粘贴代码会更容易)。