html – 如何使用“UserComments”模式项?

假设我有这样的标记
<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”?一旦列在容器上,或者在每个列表项上多次?

解决方法

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

相关文章

Mip是什么意思以及作用有哪些
怎么测试Mip页面运行情况
MIP安装的具体步骤有哪些
HTML添加超链接、锚点的方法及作用详解(附视频)
MIP的规则有哪些
Mip轮播图组件中的重要属性讲解