itemtype(属性) | itemtype (attribute)
itemtype(属性)
全局属性itemtype
指定将用于定义itemprop
数据结构中的(项目属性)的词汇表的URL 。itemscope
用于设置数据结构中设置的词汇itemtype
将处于活动状态的范围。
谷歌和其他主要的搜索引擎支持schema.org词汇表的结构化数据。这个词汇表定义了一组标准的类型名称和属性名称。例如,MusicEvent
表示音乐会表演,startDate
以及location
指定音乐会关键细节的属性。在这种情况下,MusicEvent
itemtype
,与startDate
和MusicEvent
定义的位置将被itemprop
URL使用。
注意:
关于itemtype
属性的更多信息可以在http://schema.org/Thing找到
项目类型
属性必须有一个值是一组无序独特标记,其区分大小写的,各是一个有效的和绝对的URL,并且所有定义为使用相同的词汇。该属性的值必须至少有一个令牌。
简单的例子
HTML
<div itemscope itemtype="http://schema.org/Product">
<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 |
样例
HTML
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="brand">ACME<br></span>
<span itemprop="name">Executive Anvil<br></span>
<img itemprop="image" src="https://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-924605_960_720.png" 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="http://schema.org/AggregateRating">
Rating: <span itemprop="ratingValue">4.4</span> stars, based on <span itemprop="reviewCount">89
</span> reviews
</span><p>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
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="http://schema.org/Organization">
<span itemprop="name">Executive Objects<br></span>
</span>
Condition: <link itemprop="itemCondition" href="http://schema.org/UsedCondition"/>Previously owned,
in excellent condition<br>
<link itemprop="availability" href="http://schema.org/InStock"/>In stock! Order now!
</span>
</div>
结果
HTML
结构化数据
itemscope | itemtype | Product (http://schema.org/Product) |
---|---|---|
itemprop | name | Executive Anvil |
itemprop | image | https://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-924605_960_720.png |
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. |
itemprop | mpn | 925872 |
itemprop | brand Thing | |
itemprop | name | ACME |
itemscope | itempropitemtype | aggregateRatingAggregateRating |
itemprop | ratingValue | 4.4 |
itemprop | reviewCount | 89 |
itemprop | offers Offer | http://schema.org/Offer |
itemprop | priceCurrency | USD |
itemprop | price | 119.99 |
itemprop | priceValidUntil | 2020-11-05 |
itemprop | itemCondition | http://schema.org/UsedCondition |
itemprop | availability | http://schema.org/InStock |
itemscope | itempropitemtype | seller Organization |
itemprop | name | Executive Objects |
注意
:用于从HTML中提取微数据结构的便捷工具是Google的结构化数据测试工具。试试上面显示的HTML
产品规格
规范 | 状态 | 评论 |
---|---|---|
物品种类 | | 工作组注意事项 - 不再积极发展 |
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |