开发者

Preferred approach for marking up a blog with Schema.org

Background/context

As schema.org is relatively new, perhaps this question will promote more discussion than a definitive answer. Either way, hopefully some learning from others' application/experience can be gained.

Having studied the http://schema.org documentation pages – and whilst there seems to be an extensive array of properties (read: itemprop attributes) available to enrich a blog post, there seems to be some inconsistencies and 'grey areas' with regard to the best approach to mark up blog comments. Let me provide an example:

The schema.org documentation for blogs can be found on within Thing > CreativeWork > Blog and for reference, a blog post lives within Thing > CreativeWork > Article > BlogPosting

So far, the d开发者_运维问答ocumentation and markup examples on the aforementioned pages provide enough reference to format a blog index page, and the bulk of content within an individual post (author, pubDate, articleBody, interactionCount, etc.)

The problem: applying the UserInteraction schema to individual blog comments

It is when we start to look at individual UserInteraction elements (blog comments) within the interactionCount that things get a little vague. The documentation leads us through to Thing > Event > UserInteraction > UserComments, and is described as 'User interaction: A comment about an item.' However all of the suggested properties of UserInteraction are geared towards a physical event.

The only property that appears to be relevant to a blog comment in this schema's documentation is description; which could be used for the comment body. What feels lacking is some specific context for user comments about a blog post. There's also no evidence of example markup for said comments, even a search for 'comments' on the site doesn't seem to yield any clarity.

Has anyone marked up their blog using schema.org – and how did you approach/solve this?

I'll also raise this matter via the schema.org feedback form and update this post if anything comes to light.


Have a look at the examples here http://schema.org/WebPage and notice how the reviews are used for the Books.

You can do the same for Comments in Article, here's an example:

 <div itemscope itemtype="http://schema.org/Article"> 

     <-- Article content -->

     <div itemprop="comment" itemscope itemtype="http://schema.org/UserComments">     
       <meta itemprop="discusses" content="A masterpiece of literature" />             
       <span itemprop="creator">John Doe</span>   
       <time itemprop="commentTime" datetime="2011-05-08T19:30">May 8, 7:30pm</time>    

       <span itemprop="commentText">I really enjoyed this book. It captures the essential  
       challenge people face as they try make sense of their lives.</span>    
     </div>

     <div itemprop="comment" itemscope itemtype="http://schema.org/UserComments">     
       <meta itemprop="discusses" content="A masterpiece of literature" />             
       <span itemprop="creator">John Doe</span>   
       <time itemprop="commentTime" datetime="2011-05-08T19:30">May 8, 7:30pm</time>    

       <span itemprop="commentText">I really enjoyed this book. It captures the essential  
       challenge people face as they try make sense of their lives.</span>    
     </div>

 </div>


Some years later, http://schema.org/Comment has been introduced.

A comment on an item - for example, a comment on a blog post. The comment's content is expressed via the "text" property, and its topic via "about", properties shared with all CreativeWorks.


My understanding is that UserComments is not for marking up blog comments. It exists only as one of the possible interaction types to be used with the interactionCount property on CreativeWork, such as:

<div itemscope itemtype="http://schema.org/Article">
  <span itemprop="http://schema.org/interactionCount">UserComments:7</span>
</div>

I would mark up each of the comments as a CreativeWork or Article, and make sure that their about property points to the blog post that they are commenting to.


Blaise appears to be correct as of now. The example used on schema.org/Comment is:

A comment on an item - for example, a comment on a blog post. The comment's content is expressed via the "text" property, and its topic via "about", properties shared with all CreativeWorks.


I personally don't like the <meta> approach when I have the content matching the data. Since schema.org is not yet fully documented, I went ahead with this:

<span itemprop="interactionCount">100</span>

and/or this:

<span itemprop="interactionCount">100 comments</span>

I know that it doesn't specify "UserComments" anywhere. Thoughts?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜