2

当一篇文章的作者和发布者相同时,使用 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"
},
4

1 回答 1

1

JSON-LD 中没有等效的功能。根据您是否有实体的标识符,您也许可以利用反向属性来实现相同的目的。但是,一般来说,我不建议使用这种“黑客”。

{
  "@context": [
    "http://schema.org/",
    { "publisherOf": { "@reverse": "publisher", "@type": "@id" } }
  ],
  "@id": "/book",
  "author" : {
    "@type" : "Organization",
    "name" : "Name of the Organization",
    "publisherOf": "/book"
  }
}
于 2015-06-02T20:00:08.513 回答