itemtype(属性) | itemtype (attribute)

itemtype(属性)

全局属性itemtype指定将用于定义itemprop数据结构中的(项目属性)的词汇表的URL 。itemscope用于设置数据结构中设置的词汇itemtype将处于活动状态的范围。

谷歌和其他主要的搜索引擎支持schema.org词汇表的结构化数据。这个词汇表定义了一组标准的类型名称和属性名称。例如,MusicEvent表示音乐会表演,startDate以及location指定音乐会关键细节的属性。在这种情况下,MusicEvent itemtype,与startDateMusicEvent定义的位置将被itempropURL使用。

注意:关于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>

结构化数据

itemscopeitemtypeschema.org Product
itempropnameExecutive Anvil
itempropbrand Thing
itempropnameACME

样例

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

结构化数据

itemscopeitemtypeProduct (http://schema.org/Product)
itempropnameExecutive Anvil
itempropimagehttps://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-924605_960_720.png
itempropdescriptionSleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.
itempropmpn925872
itempropbrand Thing
itempropnameACME
itemscopeitempropitemtypeaggregateRatingAggregateRating
itempropratingValue4.4
itempropreviewCount89
itempropoffers Offerhttp://schema.org/Offer
itemproppriceCurrencyUSD
itempropprice119.99
itemproppriceValidUntil2020-11-05
itempropitemConditionhttp://schema.org/UsedCondition
itempropavailabilityhttp://schema.org/InStock
itemscopeitempropitemtypeseller Organization
itempropnameExecutive Objects

注意:用于从HTML中提取微数据结构的便捷工具是Google的结构化数据测试工具。试试上面显示的HTML

产品规格

规范状态评论
物品种类工作组注意事项 - 不再积极发展

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support(Yes)(Yes)(Yes)(Yes)(Yes)

FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)