使用结构化数据设置多个评论的服务详细信息

时间:2015-05-10 12:49:16

标签: html schema.org microdata structured-data

我正在撰写推荐页面,最近我一直在利用structured data帮助SE更轻松地找到评论;根据找到的review information

现在,通常如果我正在进行一次审核,我会做这样的事情:

<div itemscope itemtype="http://schema.org/Review">
    <div itemprop="itemReviewed" itemscope itemtype="http://schema.org/Service">
        <span itemprop="provider">Business Name</span>
        <span itemprop="serviceType">Service Provided</span>
        <span itemprop="url">http://www.example.com/</span>
    </div>
    <div class="review" itemprop="reviewBody">Great service - thanks!</div>
    <div class="other">
        <p class="name" itemprop="author">Joey Bigs</p>
        <p class="details">Owner, <a href="">Joes Treats</a></p>
    </div>
</div>

现在,如果我想为同一件事做一个几个评论的页面,该怎么办?我是否需要为每次评论重复以下信息,或者我可以只显示一次?

    <div itemprop="itemReviewed" itemscope itemtype="http://schema.org/Service">
        <span itemprop="provider">Business Name</span>
        <span itemprop="serviceType">Service Provided</span>
        <span itemprop="url">http://www.example.com/</span>
    </div>

如果我只需要包含一次 - 我该怎么做呢?

1 个答案:

答案 0 :(得分:2)

您可以使用Microdata’s itemref attribute来引用经过审核的项目,因此您不必为每次审核重复该项目:

<div id="foo" itemprop="itemReviewed" itemscope itemtype="http://schema.org/Service">
  <!-- make sure that this element is not a child of another itemscope -->
</div> 

<div itemscope itemtype="http://schema.org/Review" itemref="foo"></div>

<div itemscope itemtype="http://schema.org/Review" itemref="foo"></div>

<div itemscope itemtype="http://schema.org/Review" itemref="foo"></div>