我可以在 Schema.org 的一个 itemscope 中使用多个 itemtypes 吗? [英] Can I use multiple itemtypes in one itemscope for Schema.org?

查看:40
本文介绍了我可以在 Schema.org 的一个 itemscope 中使用多个 itemtypes 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在一个项目范围内使用多个项目类型.例如我现在有这个:

<div class="wrapper" itemscope itemtype="http://schema.org/ProfessionalService"><p itemprop 来自专业服务></p><p itemprop 来自网页></p>

当我在 Google 的 Web 开发人员工具中进行结构化数据测试时,它仅选取专业服务架构中的项目,并且与网页架构相关的每个项目道具都被忽略,并且不被识别为专业服务的一部分.我了解嵌套它们以及为什么会发生这种情况.

我可以在一个项目范围内拥有多个项目类型吗?如:

<p itemprop 来自专业服务></p><p itemprop 来自网页></p>

解决方案

是的,您可以在一个 itemtype 属性中使用多种项目类型,只要它们来自相同的词汇.请参阅微数据:itemtype:

<块引用>

itemtype 属性(如果指定)的值必须是一组无序的、区分大小写的、以空格分隔的唯一标记,每个标记都是一个有效的 URL,即绝对 URL,并且所有这些都被定义为使用相同的词汇.

但请注意,需要为所有指定的项目类型定义所有属性(itemprop 值).所以你不能说一个特定的属性应该只属于一个特定的项目类型.

所以你仍然有同样的问题.在您的情况下,您应该使用正确的嵌套,或者您可以使用 itemref 属性为分散在页面上的相应项添加属性.

<小时>

FWIW,schema.org 词汇表还定义了 additionalType 属性.这也可用于从其他词汇表中指定其他项目类型.但这不允许您使用附加项类型的属性.

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>

解决方案

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.

这篇关于我可以在 Schema.org 的一个 itemscope 中使用多个 itemtypes 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆