用于显示具有多个日期/时间的事件的微数据格式 [英] Microdata format for showing an event with multiple date/time
问题描述
使用微数据,表示具有多个日期/时间预订选项的活动页面的最佳方式是什么?有时活动页面只有一个预订选项,即一个日期/时间,别无选择,这需要不同的方法吗?
<h1>网球课程</h1><ol><li>预订门票<time datetime="2001-05-15 19:00">5月15日</time><li>预订门票<time datetime="2001-05-16 19:00">5月16日</time><li>预订门票<time datetime="2001-05-17 19:00">5月17日</time></ol></section>
或者这是错误的处理方式,events
是 product
的子元素?
<h1 itemprop="name">网球课程</h1><ol><li itemscope itemtype="http://schema.org/Event">预订门票<time datetime="2001-05-15 19:00">5月15日</time><li itemscope itemtype="http://schema.org/Event">预订门票<time datetime="2001-05-16 19:00">5月16日</time><li itemscope itemtype="http://schema.org/Event">预订门票<time datetime="2001-05-17 19:00">5月17日</time></ol></section>
在这种情况下,在预订确认页面上,将整个部分包含在 event
微数据中是正确的,因为它只有一个可能的日期/时间选项?
Schema.org 定义了 Event
发生在特定时间".所以每节课都应该用它自己的Event
项来表示.
如果您可以在您的页面上预订课程,您可能需要使用 offers
属性 并为每个 Event
Offer
>.
第二个代码段中的嵌套(Product
项目中的 Event
项目)对微数据没有影响(示例).如果您想连接微数据项目,您必须使用一个属性(在 itemprop
属性内).
虽然您可以使用 Product
来表示您提供网球课程服务的事实,但似乎 Product
类型 缺少合适的属性来引用 Event
项目.典型的解决方案是同时使用这两种类型,但微数据在这方面有限(它与 RDFa 一起使用效果更好).
如果您想为所有事件提供相同的数据,您可以使用 itemref
属性(而不是为每个事件重复它).
所以基本结构可能是这样的:
<h1>网球课程</h1><p itemprop="description" id="event-desc">...</p><ol><li itemscope itemtype="http://schema.org/Event" itemref="event-desc"><div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<li itemscope itemtype="http://schema.org/Event" itemref="event-desc"><div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
</ol></节>
With Microdata, what is the best way to represent an event page with multiple date/time booking options? There will be occasions when the event page only has one booking option, i.e one set date/time, no alternative, does this require a different method?
<section>
<h1>Tennis Lessons</h1>
<ol>
<li>Book Tickets for
<time datetime="2001-05-15 19:00">May 15</time>
</li>
<li>Book Tickets for
<time datetime="2001-05-16 19:00">May 16</time>
</li>
<li>Book Tickets for
<time datetime="2001-05-17 19:00">May 17</time>
</li>
</ol>
</section>
Or is this the wrong way to approach it and the events
are children of a product
?
<section itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">Tennis Lessons</h1>
<ol>
<li itemscope itemtype="http://schema.org/Event">Book Tickets for
<time datetime="2001-05-15 19:00">May 15</time>
</li>
<li itemscope itemtype="http://schema.org/Event">Book Tickets for
<time datetime="2001-05-16 19:00">May 16</time>
</li>
<li itemscope itemtype="http://schema.org/Event">Book Tickets for
<time datetime="2001-05-17 19:00">May 17</time>
</li>
</ol>
</section>
In this case, on a booking confirmation page, it would then be correct to wrap the whole section in event
Microdata as it then only has one possible date/time option?
Schema.org defines that an Event
happens "at a certain time". So each lesson should be represented by its own Event
item.
If you can book a lesson on your page, you may want to use the offers
property and provide an Offer
for each Event
.
The nesting in your second snippet (Event
items inside the Product
item) has no influence on the Microdata (example). You have to use a property (within the itemprop
attribute) if you want to connect Microdata items.
While you could use Product
to represent the fact that you provide the service of tennis lessons, it seems that the Product
type is missing a suitable property to reference an Event
item. The typical solution would be to use both types, but Microdata is rather limited in that regard (it works better with RDFa).
If you want to provide data that is the same for all events, you could make use of the itemref
attribute (instead of repeating it for each event).
So a basic structure could be this:
<section>
<h1>Tennis Lessons</h1>
<p itemprop="description" id="event-desc">…</p>
<ol>
<li itemscope itemtype="http://schema.org/Event" itemref="event-desc">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
</div>
</li>
<li itemscope itemtype="http://schema.org/Event" itemref="event-desc">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
</div>
</li>
</ol>
</section>
这篇关于用于显示具有多个日期/时间的事件的微数据格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!