itemtype
itemtype全局属性指定了词汇的URL,它将会用于定义数据结构中的itemprop(条目属性)。itemscope用于设置词汇的生效范围,其中词汇在数据结构中由itemtype设置。
Google 和其它主流搜索引擎支持 schema.org 结构化数据词汇。这个词汇定义了一组标准的类型名称和属性名称。例如,MusicEvent表示音乐会的名称,startDate和location属性指定了音乐会的关键信息。这里,MusicEvent应该是用于itemtype的 URL,而startDate和 location 作为MusicEvent所定义的itemprop。
- itemtype属性必须拥有这样的值,它是唯一标识的无序集合,这些标识是大小写敏感的,每个标识都是有效的绝对 URL,并且所有都使用相同词汇定义。属性的值必须至少拥有一个标识。
- 条目的类型必须全部为定义在适用规范中的类型,并且必须使用相同词汇定义。
- itemtype属性只能在指定了itemscope属性的元素上指定。
- itemid属性只能在同时指定了itemscope和itemtype属性的元素上指定。它们必须仅仅在拥有itemscope属性的元素上指定,它的 itemtype 属性指定了不支持全局标识符的词汇,根据该词汇规范的定义。
- 全局标识符的准确含义,由词汇的规范决定。它留给这种规范,来定义全局标识符相同的多个条目(位于相同页面或不同页面)是否允许存在,以及对于处理 ID 相同的多个条目,使用什么处理规则。
浏览器支持
![]() | ![]() | ![]() | ![]() | ![]() |
| 所有浏览器都支持itemtype属性 | ||||
示例
<<div itemscope itemtype="https://www.lanmper.cn/"> <span itemprop="brand">acme</span> <span itemprop="name">executive anvil</span> </div>
结构化数据
| itemscope | itemtype | schema.org Product | |
| itemprop | name | Executive Anvil | |
| itemprop | brand[Thing] | ||
| itemprop | name | ACME | |
示例
<div itemscope itemtype="https://www.lanmper.cn/">
<span itemprop="brand">acme<br></span>
<span itemprop="name">executive anvil<br></span>
<img itemprop="image" src=https://www.lanmper.cn/upload/image/202002/british-flag.jpg" width="50" height="50" alt="executive anvil logo" /><br>
<span itemprop="description">sleeker than acme's classic anvil, the
executive anvil is perfect for the business traveler
looking for something to drop from a height.
<br>
</span>
product #: <span itemprop="mpn">925872<br></span>
<span itemprop="aggregaterating" itemscope itemtype="https://www.lanmper.cn/">
rating: <span itemprop="ratingvalue">4.4</span> stars, based on <span itemprop="reviewcount">89
</span> reviews<p>
</span>
<span itemprop="offers" itemscope itemtype="https://www.lanmper.cn/">
regular price: $179.99<br>
<meta itemprop="pricecurrency" content="usd" />
<span itemprop="price">sale price: $119.99<br></span>
(sale ends <time itemprop="pricevaliduntil" datetime="2020-11-05">
5 november!</time>)<br>
available from: <span itemprop="seller" itemscope itemtype="https://www.lanmper.cn/">
<span itemprop="name">executive objects<br></span>
</span>
condition: <link itemprop="itemcondition" href="https://www.lanmper.cn/"/>previously owned,
in excellent condition<br>
<link itemprop="availability" href="https://www.lanmper.cn/"/>in stock! order now!
</span>
</span>
</div>





