要将项目链接在一起,您需要一个合适的属性。喜欢author(说明哪个Person
是的创造者SoftwareApplication
),或者像hasOfferCatalog(说明哪个SoftwareApplication
是由Person
).
逆特性
In most cases, Schema.org defines its properties only for one direction. So there is only author
, and no authorOf
. If you need the property for the other direction, you can use RDFa’s rev attribute.
链接而不是重复
如果您不想重复数据(即仅定义一次并链接/引用此定义),则可以提供 URL 值。 Schema.org 允许对所有属性执行此操作,即使URL
未列为预期类型。如果你想遵循语义网最佳实践,给你的实体 URL (作为标识符)与 RDFa 的resource
属性,并使用这些 URL 作为属性值来引用实体。
为此,只需使用链接元素之一(例如,带有href
or src
属性)。
Example
使用author
案例为例:
<!-- on the page about the software: /software/5 -->
<div typeof="schema:SoftwareApplication" resource="/software/5#this">
Author:
<a property="schema:author" typeof="schema:Person" href="/persons/alice#i">Alice</a>
</div>
<!-- on the page about the person: /persons/alice -->
<div typeof="schema:Person" resource="/persons/alice#i">
Authored by:
<a rev="schema:author" typeof="schema:SoftwareApplication" href="/software/5#this">Software 5</a>
</div>
Google SDTT 中的错误
如果结构化数据测试工具给出有关缺少属性的错误,请注意,这并不意味着您的标记有问题。 Schema.org 从来不需要属性。
这只是意味着这些属性是获得特定 Google 搜索功能所需的。因此,如果您不想获得该功能(或者无法提供所有必需的属性),请忽略这些错误。