14

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

iein valdez
  • 660
  • 4
  • 11
Martin
  • 143
  • 1
  • 5

5 Answers5

11

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>
Ervald
  • 284
  • 3
  • 5
  • Excellent fleshed-out example of UserComments -- thanks for posting this. Been digging around all over and couldn't find anything explicitly showing this implementation (particularly on schema.org). +1 – nickb Oct 09 '11 at 23:15
  • Excellent – just what I needed too! – Rowan Oct 10 '11 at 08:16
  • Great example, just what I was looking for (but somehow must have missed!). Thank you @Ervald – Martin Oct 11 '11 at 14:15
  • 1
    I have few doubts about the example you suggested. In the example there a list of `Review` (singular form). But since `UserComments` is a plural form, it should contain a list of comments and not be part of a list. – freedev Aug 14 '13 at 00:29
5

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.

unor
  • 92,415
  • 26
  • 211
  • 360
3

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.

cygri
  • 9,412
  • 1
  • 25
  • 47
  • Your suggestion certainly seems to provide a logical application – and I can see the how valuable the `about` property is for us to associate comments to an article when they appear out of the document flow (i.e. somewhere else on the page/on a separate page altogether). Cheers for that alone! However it still seems an oddity that there is a dedicated page in the schema.org documentation made for `Usercomments` http://schema.org/UserComments I've implemented the `interactionCount` as above, and for now think I'll follow your suggestion above unless anything else comes to light. Thanks – Martin Jul 04 '11 at 12:31
  • p.s. I'd up-vote your answer if I had more reputation - I'd also like to implement your response before marking it as answered if that's ok! – Martin Jul 04 '11 at 12:34
  • 1
    I think you are mistaken: `Blog` (which is a more specific `CreativeWork`) lists the prop `comment`, which is a `UserComments` schema. And `UserComments` has props like `commentText` and `commentTime`. That seems a lot more specific and appropriate than marking up comments as a `CreativeWork` or `Articles`. – Blaise Nov 25 '11 at 18:04
1

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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
0

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?

Steven Vachon
  • 3,814
  • 1
  • 30
  • 30