10

私がこのようなマークアップを持っているとしましょう:

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

このマークアップで「UserComments」アイテムを使用するにはどうすればよいですか? http://schema.org/UserComments

どこに追加しitemscope itemtype="http://schema.org/UserComments"ますか?リストコンテナに1回、または各リストアイテムに複数回?

4

4 に答える 4

8

itemprop = "name"を使用するのではなく、"creator"を使用してください。

その他の例... http://homebiss.blogspot.com/2011/11/schema-markups-blogger-comments.html

于 2012-10-25T16:07:21.633 に答える
7

HTML5 Microdataタイプのアイテムの仕様に従って、コメントセクションのコンテナーに追加します。

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

したがって、コメントセクションのアイテムスコープは次のようにフォーマットされます(アイテムのプロパティを考慮に入れて)。

<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>
...
于 2012-01-14T13:00:42.373 に答える
6

各コメントは独自のアイテムになります(例ではUserComments)。articleコメントごとに要素を使用することもできます。

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

ただし、現在はコメントもあります。これはCreativeWork(UserCommentsのようなイベントではない)であるため、より適切と思われます。

于 2014-04-03T15:29:07.997 に答える
0

schema.orgのため、userComments使用してコメントに変更することをお勧めします:

UserInteractionとそのサブタイプは、ユーザーがページを操作することについて話す古い方法です。一般に、コメントなどのタイプと一緒に、アクションベースの語彙を使用することをお勧めします。

ただし、このアイテムは、commentTextプロパティを追加creatorして、人として使用できます。

于 2019-06-13T13:53:28.727 に答える