itemtype
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 theitemscope
attribute.- The
itemid
attribute can only be used when bothitemscope
anditemtype
are present, and when the vocabulary does not allow for global identifiers.
Syntax
<element itemscope itemtype="URL"> ... </element>
Example
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.
<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
- Learn more about other global attributes.
- Explore additional Microdata-related global attributes:
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.
itemscope
The itemscope attribute in HTML defines a scope for a collection of Microdata items, indicating that the elements within it represent a specific item and its related properties.
lang
The lang attribute in HTML specifies the language of an element's content, aiding browsers and search engines in accurately processing and displaying text based on its linguistic context.