【发布时间】:2014-05-03 18:28:59
【问题描述】:
我正在尝试以最符合语义的方式来组合一个 HTML 事件日历。
经过一番考虑,我决定最好使用无序列表 (<UL> ... </UL>),因为我可以轻松地将它们显示为列表或网格。
我遇到的问题是,当单个事件跨越多个日期时,似乎没有一种明显的方式可以在语义上表明这一点。
例如,假设我有一个包含六月所有日期的列表;如果我有一个在 2014 年 6 月 6 日到 2014 年 6 月 8 日之间发生的“露营之旅”活动,我可能会创建以下 HTML:
<ul>
<!-- List elements for June 1 through June 5 would come here -->
<li>
<h3>
<time datetime="2014-06-06" class="calendar_date">06</time>
</h3>
<article itemscope itemtype="http://schema.org/Event">
<header>
<h1 itemprop="name">Camping at Wapiti Lake</h1>
<time itemprop="startDate" datetime="2014-06-06">June 6, 2014</time>
- <time itemprop="endDate" datetime="2014-06-08">June 8, 2014</time>
</header>
</article>
</li>
<li>
<h3>
<time datetime="2014-06-07" class="calendar_date">07</time>
</h3>
<article itemscope itemtype="http://schema.org/Event">
<header>
<h1 itemprop="name">Camping at Wapiti Lake</h1>
<time itemprop="startDate" datetime="2014-06-06">June 6, 2014</time>
- <time itemprop="endDate" datetime="2014-06-08">June 8, 2014</time>
</header>
</article>
</li>
<li>
<h3>
<time datetime="2014-06-08" class="calendar_date">08</time>
</h3>
<article itemscope itemtype="http://schema.org/Event">
<header>
<h1 itemprop="name">Camping at Wapiti Lake</h1>
<time itemprop="startDate" datetime="2014-06-06">June 6, 2014</time>
- <time itemprop="endDate" datetime="2014-06-08">June 8, 2014</time>
</header>
</article>
</li>
<!-- The remaining List elements for June 9 through June 30 would come here -->
</ul>
我担心的是,搜索引擎和日历解析器会将其视为 3 个不同的事件,而不是 1 个跨越 3 天的事件。
我什么都不担心,还是有一种语义方式来表示 3 个<ARTICLE> 元素之间的关系或“分组”?
我这样做完全错了吗?有更好的方法吗?
【问题讨论】:
-
您是否尝试过使用丰富的 sn-ps 验证器来查看它返回的内容?此外,根据语义的显示方式来决定语义是完全错误的处理语义的方法。对不起,只有我的两分钱。我知道这可以通过 hcalendar 微格式实现。我更喜欢使用表格,但所有内容都可以视为列表 imo
标签: html date calendar semantic-markup date-range