itemtype - HTML: HyperText Markup Language 编辑

The global attribute itemtype specifies the URL of the vocabulary that will be used to define itemprop's (item properties) in the data structure. itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active.

Google and other major search engines support the schema.org vocabulary for structured data. This vocabulary defines a standard set of type names and property names. For example, MusicEventindicates a concert performance, with startDate and location properties specifying the concert's key details. In this case, MusicEvent would be the URL used by itemtype, with startDate and location as itemprop's which MusicEvent defines.

Note: More about itemtype attributes can be found at http://schema.org/Thing

  • The itemtype attribute must have a value that is an unordered set of unique tokens which are case-sensitive, each is a valid and absolute URL, and all defined to use the same vocabulary. The attribute's value must have at least one token.
  • The item types must all be types defined in applicable specifications (such as schema.org), and must all be defined to use the same vocabulary.
  • The itemtype attribute can only be specified on elements which have an itemscope attribute specified.
  • The itemid attribute can only be specified on elements which have both an itemscope attribute and an itemtype attribute specified. They must only be specified on elements with an itemscope attribute, whose itemtype attribute specifies a vocabulary not supporting global identifiers for items, as defined by that vocabulary's specification.
  • The exact meaning of a global identifier is determined by the vocabulary's specification. It is left to such specifications to define whether multiple items of the same global identifier (whether on the same page or different pages) are allowed to exist, and what processing rules for that vocabulary are, with respect to handling the case of multiple items with the same ID.

Simple example

HTML

<div itemscope itemtype="http://schema.org/Product">
  <span itemprop="brand">ACME</span>
  <span itemprop="name">Executive Anvil</span>
</div>

Structured data

itemscopeitemtypeschema.org Product
itempropnameExecutive Anvil
itempropbrand [Thing]
itempropnameACME

Example

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>

Result

HTML

Structured data

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
itemscopeitemprop[itemtype]aggregateRating[AggregateRating] 
itempropratingValue4.4
itempropreviewCount89
itempropoffers [Offer]http://schema.org/Offer
itemproppriceCurrencyUSD
itempropprice119.99
itemproppriceValidUntil2020-11-05
itempropitemConditionhttp://schema.org/UsedCondition
itempropavailabilityhttp://schema.org/InStock
itemscopeitemprop[itemtype]seller [Organization]http://schema.org/Organization
itempropnameExecutive Objects

Note: A handy tool for extracting microdata structures from HTML is Google's Structured Data Testing Tool. Try it on the HTML shown above

Specifications

SpecificationStatusComment
HTML Microdata
The definition of 'itemtype' in that specification.
Working Draft 
HTML Living Standard
The definition of 'itemprop' in that specification.
Living Standard 

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:104 次

字数:10360

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文