dtstart warning on UserComments schema

房东的猫 提交于 2020-01-02 02:00:15

问题


I have the following code for rich snippet on comments:

<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>

According to schema.org/UserComments, this is correct. However, Google's Rich Snippets Testing Tool is giving an warning:

Warning: Missing required field "dtstart".

dtstart is not even a property of UserComments event. Should I ignore this warning (Google's tool is beta)? Or am I missing something?


回答1:


I think I found the answer. The correct HTML code seems to be like this:

<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>

Each comment has its own itemscope. It means you have to repeat itemtype="http://schema.org/Comment" itemscope="itemscope" itemprop="comment" on each comment.

I came to this conclusion after checking Google's example for "Products with many offers". They use as example a eBay page that contains multiple reviews about the product. Review and Comment are both part of CreativeWork.




回答2:


I was able to get the Google validator to correctly validate a page using UserComments. I admit it's hard to decide which is the preferred comment format to use (UserComments vs Comment), but http://schema.org/CreativeWork declares comment to be of type UserComments, so I'm going with that for now.

Assuming your instance of UserComments is inside something like a CreativeWork, I believe the key to avoiding this validation error from Google is adding the itemprop='comment' property to UserComment itemscope element.

In your case, try to update your line to include that attribute, i.e.:

<ul itemprop="comment" itemscope itemtype="http://schema.org/UserComments">

I found that when UserComments contained in a CreativeWork contain the correct itemprop, Google parsed them correctly with no error. I did see this error when itemprop='comment' was missing, I believe Google is treating it as a generic event in that case. Incidentally, startDate is a synonym for dtstart (ref: https://support.google.com/webmasters/answer/164506?hl=en).




回答3:


Use it without: itemprop="comment"

<ul>
    <li id="comment-1" itemtype="http://schema.org/Comment" itemscope="itemscope">
        <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>



回答4:


After a lot of tries and errors I have found something that works and passes tests I did with a testing tool.

<div itemprop="comment" itemscope itemtype="http://schema.org/UserComments">
    <p itemprop="commentText"> bla bla bla </p>
    <span itemprop="name" class="author">billy bob</span>
    <span itemprop="commentTime" content="2014.2.28" >Feb 28 2014</span>
</div>


来源:https://stackoverflow.com/questions/11740569/dtstart-warning-on-usercomments-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!