itemtype

The itemtype attribute in HTML defines the type of an item within a structured data framework (Microdata), specifying its schema or class to enhance its semantic meaning for search engines.

itemtype Attribute

The itemtype attribute in HTML is used to specify the URL of the vocabulary that defines the properties (e.g., itemprop) for an item in a structured data format. This helps establish the type of the item and improve its semantic structure, especially for search engines.

itemscope Attribute: It defines the scope for the itemtype and applies the vocabulary.
Schema.org: A widely recognized vocabulary for structured data, supported by search engines. It defines types such as MusicEvent, with properties like startDate and location.

Rules:

  • itemtype must be an absolute, valid URL pointing to a vocabulary, with consistent use of terms within that vocabulary.
  • itemtype is applicable only to elements that also include the itemscope attribute.
  • The itemid attribute can only be used when both itemscope and itemtype are present, and when the vocabulary does not allow for global identifiers.

Syntax

index.js
<element itemscope itemtype="URL"> ... </element>

Example

Chocolate Chip Cookies

A delicious chocolate chip cookie recipe everyone will enjoy.

12 servings
  • 1 cup butter
  • 1 cup sugar
  • 2 cups flour
  • 2 cups chocolate chips

Mix all ingredients and bake at 350°F for 10-12 minutes.

index.html
<div itemscope itemtype="http://schema.org/Recipe">
  <h1 itemprop="name">Chocolate Chip Cookies</h1>
  <p itemprop="description">A delicious chocolate chip cookie recipe everyone will enjoy.</p>
  <span itemprop="recipeYield">12 servings</span>
  <div itemprop="recipeIngredient">
    <ul>
      <li>1 cup butter</li>
      <li>1 cup sugar</li>
      <li>2 cups flour</li>
      <li>2 cups chocolate chips</li>
    </ul>
  </div>
  <p itemprop="recipeInstructions">Mix all ingredients and bake at 350°F for 10-12 minutes.</p>
</div>

See Also

Conclusion

The itemtype attribute specifies the type of an item within structured data, linking it to a vocabulary like Schema.org to define its properties. It enhances semantic meaning by providing context for search engines, improving content understanding. Used alongside itemscope, it ensures that items are accurately classified within a schema for better SEO and richer search results.