Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

html - Correct way to use multiple itemtypes in Microdata

See http://microdatagenerator.org/ for example.

What is the standardized way of, for example, declaring that my page is about a LocalBusiness which is also an AutomotiveBusiness? And where is the standards document that specifies this definitively?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The W3C Microdata specification (currently a Working Draft) says about the itemtype attribute:

The itemtype attribute, if specified, must have a value that is an unordered set of unique space-separated tokens that are case-sensitive, each of which is a valid absolute URL, and all of which are in the same vocabulary. The attribute's value must have at least one token.

Multiple types from the same vocabulary

So you can specify multiple item types in an itemtype attribute if they are all from the same vocabulary (e.g. Schema.org):

<article itemscope itemtype="http://schema.org/HotelRoom http://schema.org/Offer">
 <!-- an MTE (multi-typed entity) 
      with the types 'HotelRoom' and 'Offer' -->
</article>

In your case it would typically not be necessary to provide both types, as AutomotiveBusiness inherits from LocalBusiness (i.e., every AutomotiveBusiness is also a LocalBusiness).

Multiple types from different vocabularies

If you want to provide types from multiple vocabularies, you can use Schema.org’s additionalType property:

<article itemscope itemtype="http://schema.org/AutomotiveBusiness">
  <link itemprop="additionalType" href="http://www.productontology.org/id/Automobile_repair_shop" />
 <!-- an MTE (multi-typed entity) 
      with the Schema.org type 'AutomotiveBusiness' 
      an an additional PTO type 'Automobile_repair_shop' -->
</article>

Multiple items with the same itemid value

You can also provide separate items (each with its own itemscope) and give them the same itemid value, thereby conveying that they are about the same thing:

<div itemscope itemtype="http://schema.org/HotelRoom" itemid="/rooms/42#this">
</div>

<div itemscope itemtype="http://schema.org/Offer" itemid="/rooms/42#this">
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...