如何使用 JSON-LD 将 @types 分成不同的卡片?
How do I separate @types into different cards using JSON-LD?
结构化数据测试工具不会将我的@types 分成不同的部分,而是将所有@types 放入一个主要类型:Product。我如何分离类型,以便将每个类型都验证为自己的容器?
http://imgur.com/a/MhWq2(我想从第1张图转到和第3张图类似的东西,请见谅errors/warnings)
{
"@context": "http://schema.org",
"@type": "Product",
"name": "Product1",
"image": "http://mycompany.com/logo.png",
"color": "example",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "1",
"ratingCount": "0",
"worstRating": "1",
"bestRating": "5"
},
"brand": {
"@type": "Organization",
"name": "Company1",
"logo": "http://mycompany.com/logo.png"
}
我有比这更多的标记,但我认为这足以说明我正在努力完成的工作。谢谢!
有几种方法可以做到这一点,但每种方法都不一样,因为含义不同。
例如,如果你说的是句子"My Product has an AggregateRating of <values>
and is branded by an Organization",你会说出上面的内容。
或者,您可以发表几个单独的陈述,然后 link 将它们放在一起。例如:
<script type="application/ld+json">
{
"@context": {
"@vocab": "http://schema.org/",
"id": "@id",
"graph": "@graph",
"type": "@type"
},
"graph": [
{
"type": "Organization",
"id": "#001",
"name": "Big-Daddy",
"image": "http://bigdaddy.com/logo.png"
},
{
"type": "Product",
"id": "#002",
"name": "Big-2",
"image": "http://bigdaddy.com/big-2.png",
"brand": {
"type": "Organization",
"id": "#001"
},
"aggregateRating": {
"type": "AggregateRating",
"ratingValue": "3",
"ratingCount": "20",
"worstRating": "3",
"bestRating": "4"
}
},
{
"type": "Product",
"id": "#003",
"name": "Big-3",
"image": "http://bigdaddy.com/big-3.png",
"brand": {
"type": "Organization",
"id": "#001"
},
"aggregateRating": {
"type": "AggregateRating",
"ratingValue": "3",
"ratingCount": "20",
"worstRating": "2",
"bestRating": "5"
}
}
]
}
</script>
在朗读模式下显示:"I have two products, each with AggregateRating of <values>
, that are branded by Big-Daddy."
我可以想到其他几种变体,但每一种都意味着不同。
但是,Google SDTT 承认上例中的两个产品。
结构化数据测试工具不会将我的@types 分成不同的部分,而是将所有@types 放入一个主要类型:Product。我如何分离类型,以便将每个类型都验证为自己的容器?
http://imgur.com/a/MhWq2(我想从第1张图转到和第3张图类似的东西,请见谅errors/warnings)
{
"@context": "http://schema.org",
"@type": "Product",
"name": "Product1",
"image": "http://mycompany.com/logo.png",
"color": "example",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "1",
"ratingCount": "0",
"worstRating": "1",
"bestRating": "5"
},
"brand": {
"@type": "Organization",
"name": "Company1",
"logo": "http://mycompany.com/logo.png"
}
我有比这更多的标记,但我认为这足以说明我正在努力完成的工作。谢谢!
有几种方法可以做到这一点,但每种方法都不一样,因为含义不同。
例如,如果你说的是句子"My Product has an AggregateRating of <values>
and is branded by an Organization",你会说出上面的内容。
或者,您可以发表几个单独的陈述,然后 link 将它们放在一起。例如:
<script type="application/ld+json">
{
"@context": {
"@vocab": "http://schema.org/",
"id": "@id",
"graph": "@graph",
"type": "@type"
},
"graph": [
{
"type": "Organization",
"id": "#001",
"name": "Big-Daddy",
"image": "http://bigdaddy.com/logo.png"
},
{
"type": "Product",
"id": "#002",
"name": "Big-2",
"image": "http://bigdaddy.com/big-2.png",
"brand": {
"type": "Organization",
"id": "#001"
},
"aggregateRating": {
"type": "AggregateRating",
"ratingValue": "3",
"ratingCount": "20",
"worstRating": "3",
"bestRating": "4"
}
},
{
"type": "Product",
"id": "#003",
"name": "Big-3",
"image": "http://bigdaddy.com/big-3.png",
"brand": {
"type": "Organization",
"id": "#001"
},
"aggregateRating": {
"type": "AggregateRating",
"ratingValue": "3",
"ratingCount": "20",
"worstRating": "2",
"bestRating": "5"
}
}
]
}
</script>
在朗读模式下显示:"I have two products, each with AggregateRating of <values>
, that are branded by Big-Daddy."
我可以想到其他几种变体,但每一种都意味着不同。
但是,Google SDTT 承认上例中的两个产品。