两种属性,一种类型
Two properties, one type
当一篇文章的作者和出版商是同一个人时,使用 Microdata 可以按以下方式进行标记:
<span itemprop="author publisher" itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name">Name of the Organization</span>
</span>
使用JSON-LD时,是否还有以下选项?
"author" : {
"@type" : "Organization",
"name" : "Name of the Organization"
},
"publisher" : {
"@type" : "Organization",
"name" : "Name of the Organization"
},
JSON-LD 中没有等效功能。根据您是否有实体的标识符,您可以利用反向属性来实现相同的目的。但是,一般来说,我不建议使用这样的 "hacks".
{
"@context": [
"http://schema.org/",
{ "publisherOf": { "@reverse": "publisher", "@type": "@id" } }
],
"@id": "/book",
"author" : {
"@type" : "Organization",
"name" : "Name of the Organization",
"publisherOf": "/book"
}
}
当一篇文章的作者和出版商是同一个人时,使用 Microdata 可以按以下方式进行标记:
<span itemprop="author publisher" itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name">Name of the Organization</span>
</span>
使用JSON-LD时,是否还有以下选项?
"author" : {
"@type" : "Organization",
"name" : "Name of the Organization"
},
"publisher" : {
"@type" : "Organization",
"name" : "Name of the Organization"
},
JSON-LD 中没有等效功能。根据您是否有实体的标识符,您可以利用反向属性来实现相同的目的。但是,一般来说,我不建议使用这样的 "hacks".
{
"@context": [
"http://schema.org/",
{ "publisherOf": { "@reverse": "publisher", "@type": "@id" } }
],
"@id": "/book",
"author" : {
"@type" : "Organization",
"name" : "Name of the Organization",
"publisherOf": "/book"
}
}