Can one microdata item declare more than one itemtype?

The Citead team, updated

In short. Multiple itemtype URLs are valid when they are unique absolute URLs defined by one common vocabulary.

Definition: Yes. A microdata item can declare multiple itemtype URLs when every type is defined to use the same vocabulary. The URLs appear as a space-separated value on the element that also has itemscope.

Key facts

  • The WHATWG Microdata specification identifies types by URLs and places the itemtype value on the same element as itemscope.
  • The same specification requires unique space-separated tokens, valid absolute URLs, at least one token, and one common vocabulary.
  • The item types are parsed by splitting the attribute value on ASCII whitespace. An absent attribute or a value with no tokens leaves the item with no item types.
  • Each type must be defined in an applicable specification and must use the same vocabulary as the other types on that item.
  • Schema.org's microdata guide presents https://schema.org/Movie as a type URL in the schema.org type hierarchy.

How are multiple type URLs written?

The itemtype attribute holds the URLs in one value. The specification describes a space-separated list, so a second URL does not need a second attribute. The example below uses the two type URLs that WHATWG gives as types that could share one vocabulary:

<div itemscope itemtype="https://example.org/people/teacher https://example.org/people/engineer">
</div>

The value is an unordered set of unique tokens. Each token must be a valid absolute URL, and the value must contain at least one token. Repeating one URL creates a duplicate token and fails that requirement. A relative path such as /people/teacher also fails the absolute URL requirement.

The item types are the tokens obtained by splitting the value on ASCII whitespace. This means that spaces, tabs, or line breaks can separate URLs in the attribute value. The parser treats the resulting tokens as the item's types. An element with itemtype also needs itemscope, because the specification says that itemtype must not be specified on an element without it.

What does the common vocabulary requirement mean?

A vocabulary supplies the context for type and property names. WHATWG illustrates this with a property named class: on a type from one vocabulary it might describe economic class, while on a type from another vocabulary it might describe a teacher's classroom. Multiple types can share a vocabulary, but an item cannot receive two types that use different vocabularies.

The rule applies to the URLs as a group. Two URLs can be different type identifiers and still be valid together when their definitions belong to the same vocabulary. Two URLs that happen to describe related subjects remain invalid together if their specifications assign them to different vocabularies. The applicable specifications must define every listed type and their common vocabulary.

How does this relate to Schema.org?

Schema.org's guide says that item types are provided as URLs and uses https://schema.org/Movie as its example. It also describes a type hierarchy: Thing has the properties name, description, url, and image; more specific types share properties with broader types and inherit properties from their parents.

That hierarchy supplies the vocabulary context for Schema.org types. A page using Schema.org therefore needs type URLs defined by Schema.org when it lists more than one type on one item. The guide separately shows how a property value can be another item: a new itemscope begins immediately after the corresponding itemprop, and that nested item receives its own itemtype. This is the structure to inspect when one item describes a related item with a separate type.

How can you check an item?

Inspect the element carrying itemscope and itemtype, then split the attribute value on ASCII whitespace. Check that every resulting token is unique, an absolute URL, and a type defined by an applicable specification. Finally, check that all listed types use one vocabulary. A missing itemscope, a repeated URL, a relative URL, an unknown type, or mixed vocabularies makes the markup fail one of the specification's conditions.

FAQ

Can the two type URLs come from different vocabularies?

No. WHATWG requires all item types on one item to be defined to use the same vocabulary.

Can the same type URL appear twice?

No. The itemtype value is an unordered set of unique space-separated tokens, so a duplicate URL fails the uniqueness condition.

Does one type URL satisfy the rule?

Yes. The itemtype value must contain at least one token, so a single valid absolute type URL is sufficient.

Can itemtype appear without itemscope?

No. The specification prohibits itemtype on an element that does not have itemscope.

Sources

  1. WHATWG, "HTML Standard, Microdata", undated
  2. Schema.org, "Getting started with schema.org using Microdata", undated

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark