[我有一篇文章包含汽车和视频的评论,并且我想使用JSON-LD实现以下Schema.org类型:Article
,VideoObject
和Review
。
我为每种Schema.org类型创建了以下单独的片段:
((1)条:
<script type="application/ld+json">
{ "@context": "https://schema.org",
"@type": "Article",
"name": "TitleOfArticle",
"headline": "TitleOfArticle",
"description": "DescriptionOfArticle",
"image": {
"@type": "ImageObject",
"url": "https://www.example.com/imageofcarinarticle.png",
"width": 1200,
"height": 800
},
"author": {
"@type": "Person",
"name": "John Smith"
},
"wordcount": "628",
"publisher": {
"@type": "Organization",
"name": "MyCompany",
"logo": {
"@type": "ImageObject",
"url": "https://www.example.com/companylogo.png"
}
},
"url": "https://www.example.com/articleurl",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://www.example.com/articleurl"
},
"datePublished": "2019-09-16T11:30:19",
"dateCreated": "2019-09-16T11:30:19",
"dateModified": "2019-09-16T11:30:19",
"thumbnailUrl": "https://www.example.com/imageofcar.png"
}
</script>
2)VideoObject
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "VideoObject",
"name": "TitleOfArticle",
"@id": "https://www.example.com/articleurl",
"datePublished": "2019-09-16T11:30:19",
"uploadDate": "2019-09-16T11:30:19",
"duration": "PT5M33S",
"description" : "DescriptionOfArticle",
"thumbnailURL" : "https://www.example.com/thumbnailurl.png",
"thumbnail" : "https://www.example.com/thumbnailurl.png",
"contentUrl": "https://www.example.com/videourl.mp4",
"author": {
"@type": "Person",
"name": "John Smith"
}
}
</script>
3)评论
<script type='application/ld+json'>
{
"@context": "https://schema.org/",
"@type": "Review",
"itemReviewed": {
"@type": "Car",
"name": "Mini Countryman",
"model": "Countryman",
"manufacturer": "Mini",
"bodyType": "hatchback",
"vehicleModelDate": "2019"
},
"author": {
"@type": "Person",
"name": "John Smith"
},
"image": {
"@type": "ImageObject",
"url": "https://www.example.com/imageofcarinarticle.png",
"width": 1200,
"height": 800
},
"publisher": {
"@type": "Organization",
"name": "MyCompany",
"logo": {
"@type": "ImageObject",
"url": "https://www.example.com/companylogo.png"
}
},
"@id": "https://www.example.com/articleurl",
"headline": "TitleOfArticle",
"description": "DescriptionOfArticle",
"datePublished": "2019-09-16T11:30:19",
"dateModified": "2019-09-16T11:30:19",
"reviewBody": "ReviewOfCar",
"reviewRating": {
"@type": "Rating",
"ratingValue": "6.0",
"bestRating": "10"
}
}
</script>
[当我分别使用Google结构化数据测试工具测试每个脚本时,一切都很好,没有错误。
如果我在同一页面中测试所有脚本,我仍然没有错误,但是所有类型都'合并为一种类型,Article
,如下图所示。
正确吗?
[我似乎记得在过去使用Microdata而不是JSON-LD时有Article
,VideoObject
和Review
分别的类型。
[@id
]唯一地标识一个事物,因此,如果两个事物具有相同的@id
值,则它们are相同。
您的WebPage
,VideoObject
和Review
具有相同的@id
值:
"@id": "https://www.example.com/articleurl"
如果您要提供@id
(这是一种很好的做法),则它们都应具有不同的值,除非它们确实相同。