Schema.org itemref - 将多个体育赛事链接到一个位置
我正在尝试微数据,特别是 schema.org 标签的使用。我试图描述可能具有相同位置属性的多个体育赛事。
<!--Sports Events -->
<div itemscope itemtype="http://schema.org/SportsEvent">
<span itemprop="name" style="font-weight:bold;">Event One</span><br />
<meta itemprop="location" content="venue" itemscope itemtype="http://schema.org/Place" itemref="olympicpark" />
<meta itemprop="startDate" content="2011-08-04T10:00">
<meta itemprop="endDate" content="2011-08-04T13:45">
</div>
<div itemscope itemtype="http://schema.org/SportsEvent">
<span itemprop="name" style="font-weight:bold;">Event Two</span><br />
<meta itemprop="location" content="venue" itemscope itemtype="http://schema.org/Place" itemref="olympicpark" />
<meta itemprop="startDate" content="2011-08-04T10:00">
<meta itemprop="endDate" content="2011-08-04T13:45">
</div>
<!--End Events -->
<!--Places -->
<h3>Venues</h3>
<div id="olympicpark">
<a itemprop="url" href="http://www.london2012.com/olympic-park">Olympic Park</a>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Olympic Park</span>
<span itemprop="addressLocality">Stratford</span>
<span itemprop="addressRegion">London</span>
<span itemprop="postalCode">E20 2ST</span>
</div>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="51.54615" />
<meta itemprop="longitude" content="-0.01269" />
</div>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">4</span> stars - based on
<span itemprop="reviewCount">250</span> reviews
</div>
</div>
<!-- End Places -->
每个体育赛事的属性“位置”通过 itemref 属性链接到“奥林匹克公园”地点。这似乎是正确的,谷歌丰富的摘要工具报告没有错误。我唯一担心的是,丰富的代码片段数据显示的位置属性不直接指向奥林匹克公园,而是指向引用它的另一个项目。
如下所示:
Item
Type: http://schema.org/sportsevent
name = Event Two
location = Item( 2 )
startdate = 2011-08-04T10:00
enddate = 2011-08-04T13:45
Item 2
Type: http://schema.org/place
Ref to item: Item( olympicpark )
我希望看到的是每个体育赛事项目的微观数据报告“location = Item (olympicpark)”。如果我将位置更改为以下内容,我可以得到这个
<span itemprop="location" content="venue" itemscope itemtype="http://schema.org/Place" itemref="olympicpark">
如果我这样做,则不会使用开始日期和结束日期,我可以理解这一点,因为跨度标签不会关闭。
我正在绕圈试图解决这个问题,如果可能的话,我真的很感激一些帮助。如果这看起来令人困惑,我很抱歉,我发现很难描述这个问题。
麦克风
I am experimenting with microdata in particular the use of schema.org tags. I am trying to describe multiple sports events that may have the same location property.
<!--Sports Events -->
<div itemscope itemtype="http://schema.org/SportsEvent">
<span itemprop="name" style="font-weight:bold;">Event One</span><br />
<meta itemprop="location" content="venue" itemscope itemtype="http://schema.org/Place" itemref="olympicpark" />
<meta itemprop="startDate" content="2011-08-04T10:00">
<meta itemprop="endDate" content="2011-08-04T13:45">
</div>
<div itemscope itemtype="http://schema.org/SportsEvent">
<span itemprop="name" style="font-weight:bold;">Event Two</span><br />
<meta itemprop="location" content="venue" itemscope itemtype="http://schema.org/Place" itemref="olympicpark" />
<meta itemprop="startDate" content="2011-08-04T10:00">
<meta itemprop="endDate" content="2011-08-04T13:45">
</div>
<!--End Events -->
<!--Places -->
<h3>Venues</h3>
<div id="olympicpark">
<a itemprop="url" href="http://www.london2012.com/olympic-park">Olympic Park</a>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Olympic Park</span>
<span itemprop="addressLocality">Stratford</span>
<span itemprop="addressRegion">London</span>
<span itemprop="postalCode">E20 2ST</span>
</div>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="51.54615" />
<meta itemprop="longitude" content="-0.01269" />
</div>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">4</span> stars - based on
<span itemprop="reviewCount">250</span> reviews
</div>
</div>
<!-- End Places -->
The property "location" of each sport event is linked to the "olympic park" place via the itemref property. This seems to be correct, and the google rich snippets tool reports no errors. My only concern is that the rich snippet data shows the location property not pointing directly to the olympicpark but to another item which references it.
This can be seen below:
Item
Type: http://schema.org/sportsevent
name = Event Two
location = Item( 2 )
startdate = 2011-08-04T10:00
enddate = 2011-08-04T13:45
Item 2
Type: http://schema.org/place
Ref to item: Item( olympicpark )
What I would like to see is the microdata reporting "location = Item ( olympicpark )" for each sports event item. I can get this if i change the location to the following
<span itemprop="location" content="venue" itemscope itemtype="http://schema.org/Place" itemref="olympicpark">
If I do this however, then the start date and end date are not used, which I can understand because the span tag does not get closed.
I am going round in circles trying to resolve this, would really appreciate some help if possible. Apologies if this seems confusing, im finding it hard to describe the problem.
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我没有发现你原来的实现有什么问题。根据我在自己的网站上阅读和体验的内容,按照您的方式进行操作是正确的,以避免在每个事件中显式创建嵌套的多个位置。
谷歌丰富的摘要工具向您显示这一点的原因是因为它需要传达位置的类型。如果它只是按照您的意愿执行
location = Item ( olympicpark )
操作,您就会想知道它将Item ( olympicpark)
识别为什么类型。I don't see anything wrong with your original implementation. From what I've read and experienced on my own sites, doing it the way you are is correct to avoid explicitly creating multiple locations nested within each event.
The reason the google rich snippet tool is showing you that is because it needs to convey what type the location is. If it just did
location = Item ( olympicpark )
like you desire, you'd be left wondering what type did it recognizeItem ( olympicpark)
as.您可能应该在 olympicpark div 中指定 itemscope 和 itemtype,并使用 itemid 而不是 id。检查以下内容:如何关联 schema.org 中的项目?
You should probably specify the itemscope and itemtype in your olympicpark div, and use itemid instead of id. Check this: How do I relate items in schema.org?
它完全正确,您一定不要对此感到困惑:您使用
itemprop="location" itemscope itemtype="http://schema.org/Place"
创建一个具有自己属性的嵌入/嵌套项目,正确显示为 item2 的属性Its fully correct, you must not be confused about it: you create with
itemprop="location" itemscope itemtype="http://schema.org/Place"
an embedded/nested item with own properties, which are correctly shown as properties of item2