9

我在我的网站上实施了 Google 的附加链接搜索框。它工作得很好。但是今天我再次检查了谷歌结构化数据测试工具,并且出现了问题。现在我遇到以下错误:

谷歌结构化数据测试工具:网站的 2 个错误

我的实现是:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.saatler.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://www.saatler.com/arama?ara={search_term_string}",
    "query-input":"required name=search_term_string"
  }
}
</script>

当我在JSON-LD 操场上检查 JSON 时,一切看起来都很好。我没有更改我网站上的任何内容。谷歌在这个问题上错了吗?还是 Schema.org 结构发生了变化?我应该怎么做才能解决这两个问题?

4

3 回答 3

12

通过查看schema.org 潜在行动页面找到了答案。

显然,无论出于何种原因,Google 的结构化数据测试工具都不喜欢我们用于输入和输出文本表示的速记版本。

当我切换到详细版本时,我得到了WebSite(1)的良好复选标记,而不是http://www.example.com/Website(1)。

输入和输出的文本表示

为方便起见,我们还支持这两种类型的文本速记,其格式和命名类似于它们在 HTML 等效项中的显示方式。例如:

"<property>-input": {
  "@type": "PropertyValueSpecification",
  "valueRequired": true,
  "valueMaxlength": 100,
  "valueName": "q"
}

也可以表示为:

<property>-input: "required maxlength=100 name=q"

这是我们的完整代码,供其他尝试遵循此操作的人使用:

<script type="application/ld+json">
{

  "@context": "http://schema.org",
  "@type": "WebSite",
  "name" : "Example Company",
  "url": "http://www.example.com/",
  "sameAs" : [ "https://www.facebook.com/pages/Example/###############",
    "https://plus.google.com/b/#####################/#####################"],
  "potentialAction": {
    "@type": "SearchAction",
    "target": "http://www.example.com/search/results/?q={q}",
    "query-input": {
        "@type": "PropertyValueSpecification",
        "valueRequired": true,
        "valueMaxlength": 100,
        "valueName": "q"
    }
  }
}
</script>
于 2015-06-12T14:10:41.847 回答
6

我注意到,即使是在线文档中的示例也会收到与您收到的完全相同的错误。当我改变

"@context": "http://schema.org"

"@context": "http://schema.org/true"

错误消失了。希望这可以帮助。

在此处输入图像描述

<script type="application/ld+json">
{
  "@context": "http://schema.org/true",
  "@type": "WebSite",
  "url": "https://www.saatler.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://www.saatler.com/arama?ara={search_term_string}",
    "query-input":"required name=search_term_string"
  }
}
</script>

于 2015-06-11T17:55:13.703 回答
2

是 Google 结构化数据测试工具中的一个错误

现在已修复:该工具不再为您的标记报告错误。

于 2015-06-30T18:28:51.753 回答