rlc*_*ral 9 html html5 microdata schema.org
我对注释中的丰富代码段有以下代码:
<ul itemscope itemtype="http://schema.org/UserComments">
<li id="comment-1" class="comment">
<span itemprop="name" class="author">Author 1</span>
<p itemprop="commentText">Bla Bla Bla</p>
<time itemprop="commentTime" content="2012-07-29" datetime="2012-07-29T05:55+00:00" title="Jul 29, 2012 5:55">2 days ago</time>
</li>
<li id="comment-2" class="comment">
<span itemprop="name" class="author">Author 2</span>
<p itemprop="commentText">yada yada yada</p>
<time itemprop="commentTime" content="2012-07-30" datetime="2012-07-30T04:44+00:00" title="Jul 30, 2012 4:44">yesterday</time>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
根据schema.org/UserComments,这是正确的.但是,谷歌的Rich Snippets测试工具正在发出警告:
警告:缺少必填字段"dtstart".
dtstart
甚至不是UserComments事件的属性.我应该忽略这个警告(谷歌的工具是测试版)吗?或者我错过了什么?
rlc*_*ral 11
我想我找到了答案.正确的HTML代码似乎是这样的:
<ul>
<li id="comment-1" itemtype="http://schema.org/Comment" itemscope="itemscope" itemprop="comment">
<span itemprop="author">Author 1</span>
<p itemprop="text">Bla Bla Bla</p>
<time itemprop="dateCreated" content="2012-07-29" datetime="2012-07-29T05:55+00:00" title="Jul 29, 2012 5:55">2 days ago</time>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
每个评论都有自己的itemcope.这意味着你必须重复itemtype="http://schema.org/Comment" itemscope="itemscope" itemprop="comment"
每一条评论.
在查看Google的"有许多优惠的产品"示例后,我得出了这个结论.他们使用eBay页面作为示例,其中包含有关产品的多个评论.评论和评论都是CreativeWork的一部分.