Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

itemtype

Эта статья нуждается в техническом обзоре. Как вы можете помочь.

Эта статья нуждается в редакционном обзоре. Как вы можете помочь.

Наши волонтёры ещё не перевели данную статью на Русский. Присоединяйтесь к нам и помогите закончить эту работу!

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, MusicEvent indicates a concert performance, with startDate and location properties to specify the concert's key details. In this case, MusicEvent would be the URL used by itemtype and startDate and location would be itemprop's that MusicEvent defines.

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

  • The itemtype attribute must have a value that is an unordered set of unique tokens that are case-sensitive, each of which is a valid URL that is an absolute URL, and all of which are 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 that have an itemscope attribute specified.
  • The itemid attribute can only be specified on elements that have both an itemscope attribute and an itemtype attribute specified, and can only be specified on elements with an itemscope attribute whose itemtype attribute specifies a vocabulary that does not support 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 up to such specifications to define whether multiple items with the same global identifier (whether on the same page or different pages) are allowed to exist, and what the 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="https://schema.org/Product">
  <span itemprop="brand">ACME</span>
  <span itemprop="name">Executive Anvil</span>
</div>

Structured data

itemscope itemtype schema.org Product
itemprop name Executive Anvil
itemprop brand [Thing]
itemprop name ACME

Example

HTML

<div itemscope itemtype="https://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="https://schema.org/AggregateRating">
    Rating: <span itemprop="ratingValue">4.4</span> stars, based on <span itemprop="reviewCount">89
      </span> reviews<p>
  </span>
  
<span itemprop="offers" itemscope itemtype="https://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="https://schema.org/Organization">
                      <span itemprop="name">Executive Objects<br></span>
                    </span>
    Condition: <link itemprop="itemCondition" href="https://schema.org/UsedCondition"/>Previously owned,
      in excellent condition<br>
    <link itemprop="availability" href="https://schema.org/InStock"/>In stock! Order now!
</span>

  </span>

</div>

Result

HTML

Structured data

itemscope itemtype Product (https://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 itemprop[itemtype] aggregateRating[AggregateRating]  
itemprop ratingValue 4.4
itemprop reviewCount 89
itemprop offers [Offer] https://schema.org/Offer
itemprop priceCurrency USD
itemprop price 119.99
itemprop priceValidUntil 2020-11-05
itemprop itemCondition https://schema.org/UsedCondition
itemprop availability https://schema.org/InStock
itemscope itemprop[itemtype] seller [Organization] https://schema.org/Organization
itemprop name Executive 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

Specification Status Comment
itemtype   WG Note - No longer being actively developed

Browser compatibility

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)

See also

Метки документа и участники

 Внесли вклад в эту страницу: SphinxKnight, rohanmahajan, rolfedh, duncanmcdonald
 Обновлялась последний раз: SphinxKnight,