似乎Google现在已经实施了Schema.org版本2,Google自己的示例无法通过Google的验证测试。例如,这里是Google's example JSON-LD code for breadcrumbs:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "https://example.com/arts",
"name": "Arts"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "https://example.com/arts/books",
"name": "Books"
}
},
{
"@type": "ListItem",
"position": 3,
"item": {
"@id": "https://example.com/arts/books/poetry",
"name": "Poetry"
}
}
]
}
</script>
昨天,当我将上述代码粘贴到test.html
文件中时,Google's validation tool将其验证为&#34; Pass&#34;。
今天,它失败了。您现在似乎必须明确定义mainEntity
。但他们并不打算更新他们的文档。
有谁知道在哪里可以找到使用JSON-LD的官方文档? Schema.org提供的内容并不多,而且似乎也已过时。我设法得到以下代码来通过测试:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"mainEntity": {
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "http://www.example.com",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "http://www.example.com/shop.com",
"name": "Shop"
}
}
]
}
}
</script>
我担心的是:
我们假设您还使用微数据在同一页面上定义产品,搜索引擎会将面包屑列表视为mainEntity
吗?即它在搜索结果中的排名会高于产品吗?
答案 0 :(得分:2)
你必须分开关注:
Google是supports结构化数据的消费者
Schema.org不能“过时”:它们当然是他们自己的类型/属性的规范来源。如果他们的某些类型/属性被弃用,它们通常会成为词汇表的一部分。
“使用JSON-LD的官方文档”是W3C建议书(上面链接)。
如果我正确理解您的问题,那么您的问题就出在谷歌:他们的文档与他们的测试工具。 They document他们支持Schema.org’s BreadcrumbList
type,但their testing tool无法识别此类型:
itemtype 属性的值无效。
(虽然此错误消息引用“itemtype”,这是一个Microdata属性,但无论您测试哪种支持的语法,它都会出现。)
你无能为力。第一个片段是有效的JSON-LD,它是Schema.org词汇表的恰当使用。 Google甚至以这种方式记录它的事实使得他们的测试工具可能目前被窃听(之前发生过几次)。
关于你的第二个片段:使用mainEntity
这种方式可能不是你想传达的。你是说面包屑是网页的主要实体,但这种情况非常罕见。通常,主要实体是Article
等。