Can I use multiple itemtypes in one itemscope for Schema.org? [duplicate]

佐手、 提交于 2020-01-01 04:45:10

问题


I am wondering if I can use multiple itemtypes inside one item scope. For example I have this at the moment:

<body id="home" itemscope itemtype="http://schema.org/WebPage">       
  <div class="wrapper" itemscope itemtype="http://schema.org/ProfessionalService">
    <p itemprop from professional service></p>
    <p itemprop from web page></p>
  </div>
</body>

When I do a structured data test within Google's Web developer tools it only picks up items within the professional service schema and every itemprop that is related to the webpage schema is ignored and not recognised as part of the professional service. I understand about nesting them and why it's happening.

Can I have a multiple itemtype within an item scope? Such as:

<div class="wrapper" itemscope itemtype="http://schema.org/ProfessionalService http://schema.org/WebPage">
    <p itemprop from professional service></p>
    <p itemprop from web page></p>
</div>

回答1:


Yes, you can use several item types in one itemtype attribute, as long as they are from the same vocabulary. See Microdata: itemtype:

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 URL that is an absolute URL, and all of which are defined to use the same vocabulary.

But note that then all properties (itemprop values) need to be defined for all the specified item types. So you cannot say that a particular property should belong only to a particular item type.

So you’d still have the same problem. In your case, you should either use correct nesting, or you might use the itemref attribute to add properties to the corresponding items that are scattered on the page.


FWIW, the schema.org vocabulary also defines the additionalType property. This can also be used to specify additional item types from other vocabularies. But this doesn’t allow you to use the properties from the additional item type.



来源:https://stackoverflow.com/questions/21961980/can-i-use-multiple-itemtypes-in-one-itemscope-for-schema-org

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!