看起來好像谷歌現在已經實施了Schema.org第2版並且谷歌自己的例子沒有通過Google的驗證測試。例如,下面的是Google's example JSON-LD code for breadcrumbs:Google現在支持Schema.org的新版本BreadcrumbList?
<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驗證它作爲「通行證」。
今天失敗了。看起來你現在必須明確定義一個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
?即它在搜索結果中的排名是否會高於產品?
在上一個問題中,您是否確實是指「Microdata」?所以你想爲'Product'的'BreadcrumbList'和Microdata使用JSON-LD? – unor
[使用Microdata時出現同樣的問題](http://stackoverflow.com/q/32249948/1591669) – unor
根據谷歌的其他方式。以下是谷歌推薦的摘錄:谷歌正在將JSON-LD支持添加到更多標記驅動功能。到目前爲止,所有Knowledge Graph功能,附加鏈接搜索框,Event Rich Snippets和Recipe Rich Snippe都支持JSON-LD; Google建議爲這些功能使用JSON-LD。對於剩餘的Rich Snippets類型和麪包屑,Google建議使用微數據或RDFa。 https://developers.google.com/structured-data/schema-org – user1749141