我有以下代码用于丰富的代码段:
<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>
根据schema.org/UserComments,这是正确的.但是,Google’s Rich Snippets Testing Tool正在发出警告:
Warning: Missing required field “dtstart”.
dtstart甚至不是UserComments事件的属性.我应该忽略这个警告(Google的工具是beta)吗?还是我错过了什么?
解决方法
我想我找到答案.正确的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>
每个评论都有自己的itemscope.这意味着你必须在每个注释上重复itemtype =“http://schema.org/Comment”itemscope =“itemscope”itemprop =“comment”.
检查Google’s example for “Products with many offers”后,我得出了这个结论.他们以eBay为例,其中包含有关该产品的多个评论. Review和Comment都是CreativeWork的一部分.