架构标记:如何暂时“逃避”的itemscope [英] Schema Markup: How to temporarily "escape" itemscope
问题描述
我想使用Schema标记一些内容但是我的itemscopes遇到了问题。
I would like to markup some content using Schema but am running into an issue with my itemscopes.
我现在有以下标记:
<div itemscope itemtype="https://schema.org/medicalClinic">
<div itemprop="availableService" itemscope itemtype="https://schema.org/MedicalProcedure">
<span itemprop="name">First Service Name</span>
<span itemprop="description">First Service Description</span>
<div itemprop="availableService itemscope itemtype="https://schema.org/MedicalProcedure">
<span itemprop="name">Second Service Name</span>
<span itemprop="description">Second Service Description</span>
</div><!-- end second service -->
<span itemprop="followup">First Service Followup</span>
</div><!-- end first service -->
</div><!-- end MedicalClinic schema -->
由于内容的结构方式,第二项服务出现在第一个服务的容器。第一个服务的Itemprops出现在第二个服务之前和之后。
Due to the way the content is structured, a second service appears in the middle of the container for the first service. Itemprops for the first service appear before and after the second service.
Google的结构化数据测试工具显示一条错误,指出availableService不是availableService的属性(显然不是我想要的)反正蚂蚁)。
Google's structured data testing tool shows an error stating that an availableService is not a property of an availableService (obviously not what I would want anyway).
我的问题是如何逃避我的第一次服务的范围所以我能够标记我的第二次服务,然后重新进入第一个服务的范围?
My question is how do I "escape" the scope of my first service so I am able to markup my second service, and then re-enter the first service's scope?
推荐答案
这有一个丑陋的解决方案,包括添加 div
itemscope
(不含 itemtype
)和 itemref
+ id
:
There’s an ugly solution for this which involves adding a div
with an itemscope
(without itemtype
) and itemref
+id
:
<div itemscope itemtype="http://schema.org/MedicalClinic" itemref="second-service">
<div itemprop="availableService" itemscope itemtype="http://schema.org/MedicalProcedure">
<span itemprop="name">First Service Name</span>
<span itemprop="description">First Service Description</span>
<div itemscope>
<div itemprop="availableService" itemscope itemtype="http://schema.org/MedicalProcedure" id="second-service">
<span itemprop="name">Second Service Name</span>
<span itemprop="description">Second Service Description</span>
</div><!-- end second service -->
</div> <!-- end dummy div -->
<span itemprop="followup">First Service Followup</span>
</div><!-- end first service -->
</div><!-- end MedicalClinic schema -->
关于你的加价的注释:
- 您可能希望使用HTTP而不是HTTPS Schema.org URI
- Schema.org URI区分大小写(例如,它是
http://schema.org/MedicalClinic
,而不是http:// schema.org/medicalClinic
) - 你错过了
itemprop
的收盘
- you may want to use HTTP instead of HTTPS Schema.org URIs
- Schema.org URIs are case-sensitive (e.g., it’s
http://schema.org/MedicalClinic
, nothttp://schema.org/medicalClinic
) - you were missing an
itemprop
’s closing"
这篇关于架构标记:如何暂时“逃避”的itemscope的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!