【发布时间】:2018-07-05 17:42:37
【问题描述】:
我想知道如何使用 JSON-LD(Google 提供的recommended)和 Schema.org 规范来表示重复属性。例如,我们应该如何用 N Comments (N > 1) 来表示 Article?
允许有一个数组作为comment 值,如下面的示例。似乎是的,因为Google testing tool 喜欢它。
但是是否允许使用 flat @graph 表示来代替?如何?我必须发展一个网站,这种表示可能更容易实现。
我想两者都是允许的?那么如何选择呢?
我的例子:
<script type="application/ld+json">
{
"@context" : "http:\/\/schema.org",
"@type" : "Article",
"url" : "https:\/\/exemple.com/article?id=1234",
"author" :{"@type" : "Person","name" : "Didier"},
"image" : "https:\/\/exemple.com/article.jpg",
"mainEntityOfPage" : "https:\/\/exemple.com",
"dateModified" : "2018-06-14T19:50:02+02:00",
"datePublished" : "2018-06-14T19:50:02+02:00",
"publisher" : {"@type" : "Organization","name" : "exemple.com", "logo" : {"@type" : "ImageObject", "url" : "https:\/\/exemple.com\/logo.png"}},
"headline" : "my article",
"text" : "blah blah",
"commentCount" : 2,
"comment" : [{
"author" : {"@type" : "Person", "name" : "Didier"},
"text" : "comment first!!",
"dateCreated" : "2018-06-14T21:40:00+02:00"
},{
"author" : {"@type" : "Person", "name" : "Robert"},
"text" : "second comment",
"dateCreated" : "2018-06-14T23:23:00+02:00"
}]
}
</script>
【问题讨论】:
标签: schema.org json-ld