我想使用微数据的网页。但没有一个现有可用的架构似乎适合我的内容。我需要坚持只定义的模式或者我可以定义自己的?另外,我可以有一个空itemscope
还是最好定义?
<h1>Page Title</h1>
(table of contents)
term 1
term 2
...
<div itemscope>
<h2 itemprop="term">1. Piston</h2>
<h3>Definition - What does Piston mean?</h3>
<span itemprop="definition">A definition</span>
<h3>Explanation of Piston</h3>
<span itemprop="explanation">An explanation</span>
<h3>How to use Piston in a sentence.</h3>
<span itemprop="usage">Sentence using term.</span>
</div>
我有在同一页上10项,每个信息的这同一位。它是确定有一个未定义的itemscope
?或者我应该把它定义类似“汽车零部件”?或者,我们可以不定义自己的itemscope
,而是从现有的模式结构选择?
通过谷歌的架构工具运行,它说没有任何警告或错误,但当然也给了我一个“未指定类型”和以下。
@type
https://search.google.com/term
https://search.google.com/definition
https://search.google.com/usage
选择1:你可以(在你的例子一样)使用itemscope
没有itemtype
。这将是一个本地的词汇,你不能指望微观数据消费者使用的数据。
<div itemscope>
<p itemprop="term">…</p>
<p itemprop="definition">…</p>
</div>
选项2:你可以定义和使用自己的词汇。这是不可能的,许多微观数据的消费者能够利用这些数据,不过,因为其中大部分人只认某些词汇。
<div itemscope itemtype="https://example.com/my-vocabulary/">
<p itemprop="term">…</p>
<p itemprop="definition">…</p>
</div>
方案三(推荐):你可以使用Schema.org尽可能,并用自己的类型/属性,其中Schema.org不提供合适的条件。你自己的属性就必须被指定为绝对URI,和自己的类型必须被指定为Schema.org的additionalType
属性URI值。作为Schema.org类型,你总是可以使用Thing
如果没有更具体的类型可用。
<div itemscope itemtype="http://schema.org/Thing">
<link itemprop="additionalType" href="https://example.com/my-vocabulary/CarPartTerm" />
<p itemprop="https://example.com/my-vocabulary/term">…</p>
<p itemprop="https://example.com/my-vocabulary/definition">…</p>
</div>
这就是说,它可能是Schema.org确实为你的情况提供适合的类型/属性,例如,也许DefinedTerm
(Pending)的情况。如果你认为有用的类型/属性在Schema.org丢失,你可以propose that it gets added。