Domanda

Let's say I have the mark-up like this:

<ul id="comments">

  <li class="comment"> 
    <div class="author">on Friday 3th, Jenny said:</div>
    <div class="content"><p>bla bla</p></div> 
  </li>

  <li class="comment"> 
    <div class="author">on Friday 3th, Jenny said:</div>
    <div class="content"><p>bla bla</p></div> 

    <ul class="level-2">
      <li class="comment"> 
        <div class="author">on Friday 3th, Mary said:</div>
        <div class="content">stfu jenny</div> 
      </li>       
    </ul>
  </li>
  ...

How do I use the "UserComments" item on this mark-up ? http://schema.org/UserComments

Where do I add itemscope itemtype="http://schema.org/UserComments" ? Once on the list container, or multiple times on each list item?

È stato utile?

Soluzione

According to the HTML5 Microdata typed items specs, you would add it to the container of your comments section, e.g.

<section itemscope itemtype="http://example.org/animals#cat">
 <h1 itemprop="name">Hedral</h1>
 <p itemprop="desc">Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.</p>
 <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
</section>

So the item scope for your comment section would be formatted like this (taking into account the item properties):

<ul id="comments" itemscope itemtype="http://schema.org/UserComments">

  <li class="comment"> 
    <div itemprop="name" class="author"><span itemprop="commentTime">on Friday 3th</span>, Jenny said:</div>
    <div itemprop="commentText" class="content"><p>bla bla</p></div> 
  </li>

  <li class="comment"> 
    <div itemprop="name" class="author"><span itemprop="commentTime">on Friday 3th</span>, Jenny said:</div>
    <div itemprop="commentText" class="content"><p>bla bla</p></div> 

    <ul class="level-2">
      <li class="comment"> 
        <div itemprop="name" class="author"><span itemprop="commentTime">on Friday 3th</span>, Mary said:</div>
        <div itemprop="commentText" class="content">stfu jenny</div> 
      </li>       
    </ul>
  </li>
...

Altri suggerimenti

You shouldn't be using itemprop="name", but instead use "creator".

More examples... http://homebiss.blogspot.com/2011/11/schema-markups-blogger-comments.html

Each comment would be an own item (UserComments in your example). You might also want to use an article element for each comment.

<article itemscope itemtype="http://schema.org/UserComments">
  <header>
    on 
    <time itemprop="commentTime" datetime="…">Friday 3th</time>, 
    <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
      <span itemprop="name">Jenny</span>
    </span> 
    said:
  </header>
  <p itemprop="commentText">bla bla</p>
</article>

However, now there is also Comment, which seems to be more appropriate because it’s a CreativeWork (and not an Event, like UserComments).

Due to schema.org, It is good to change using userComments to Comment:

UserInteraction and its subtypes is an old way of talking about users interacting with pages. It is generally better to use Action-based vocabulary, alongside types such as Comment.

But you can use this item by adding commentText property and creator as a person to it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top