2014-10-08 40 views
0

我有一些结构化数据在我的网站中使用微数据实现,以便谷歌和其他搜索引擎可以解析它并显示适当的丰富片段。我已为所用的所有微数据标记添加了适当的标记,但我无法在使用Rich Snippets测试工具对其进行测试时查看我网站的丰富网页摘要。我已经浏览了Google网站管理员的使用指南和常见问题部分,但无济于事。schema.org标记和嵌套复习“ApartmentComplex”

在调试html时,我发现以下代码片段在提供给Rich Snippets测试工具时已成功显示丰富网页摘要。

<div class="row"> 
       <div class="col-sm-12"> 
        <div class="page-header"> 
         <h1><span itemprop="name">T Park </span></h1> 
           <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" class="address"> 
           <span itemprop="streetAddress">1 Scenic Park</span> 
           <span itemprop="postalCode" class="hidden">123456</span> 
           <span itemprop="addressRegion" class="hidden">Central </span> 
           <span itemprop="addressCountry" class="hidden">Singapore</span> 
        </div> 
       </div> 
      </div> 
     </div> 
      <div class="col-sm-6 box-map"> 
       <h2>Location</h2> 
      </div> 
     <div style="margin-bottom:0px;" itemprop="review" itemscope itemtype="http://schema.org/Review" class="jumbotron row"> 
      <h2>T Park Reviews</h2> 
      <br> 
      <meta itemprop="itemReviewed" content="T Park"> 
      <div id="reviews" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> 
       <meta itemprop="worstRating" content="1"> 
       <meta itemprop="ratingValue" content="9"> 
       <meta itemprop="bestRating" content="10"><span>Rating: 9/10</span> 
      </div> 
      <br><span itemprop="reviewBody">Lorem Ipsum....</span> 
      <br><strong itemprop="author" class="row pull-right">John May</strong> 
     </div> 

然而只要如显示在下面的代码段ApartmentComplex的包围标记被添加,富片段是不可见的。

<div itemscope itemtype="http://schema.org/ApartmentComplex" class="container"> 
    <div class="row"> 
     <div class="col-sm-12"> 
      <div class="page-header"> 
       <h1><span itemprop="name">T Park </span></h1> 
        <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" class="address"> 
        <span itemprop="streetAddress">1 Scenic Park</span> 
        <span itemprop="postalCode" class="hidden">123456</span> 
        <span itemprop="addressRegion" class="hidden">Central</span> 
        <span itemprop="addressCountry" class="hidden">Singapore</span> 
      </div> 
     </div> 
    </div> 
    </div> 
    <div style="margin-bottom:0px;" itemprop="review" itemscope itemtype="http://schema.org/Review" class="jumbotron row"> 
     <h2>T Park Reviews</h2> 
     <br> 
     <meta itemprop="itemReviewed" content="T Park"> 
     <div id="reviews" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> 
      <meta itemprop="worstRating" content="1"> 
      <meta itemprop="ratingValue" content="9"> 
      <meta itemprop="bestRating" content="10"><span>Rating: 9/10</span> 
     </div> 
     <br><span itemprop="reviewBody">Lorem Ipsum....</span> 
     <br><strong itemprop="author" class="row pull-right">John May</strong> 
    </div> 
</div> 

因此,假如我的网页是关于ApartmentComplex,我想包括它的评论,我应该如何组织/巢状标记?

回答

1

我不认为你的标记或Microdata有任何问题。我只是不认为Google结构化数据工具会显示http://schema.org/ApartmentComplex类型的任何丰富网页摘要 - 丰富网页摘要仅适用于某些schema.org类型。

为了证明这一点,将包装的ApartmentComplex类型更改为产品类型,并删除地址(不是“产品”的一部分),您将看到在Google Structured中生成的丰富片段数据测试工具(因为谷歌显示产品丰富的片段)。

编辑补充:这是一个可能的解决方法 - 谷歌显示schema.org类型,其中周围的类型是评论丰富网页摘要,因此您可以使用评价为顶层类型,然后有ApartmentComplex键入为“itemReviewed”属性 - 这适用于Google结构化数据测试工具:

<div itemscope itemtype="http://schema.org/Review" class="container"> 
    <div class="row" itemprop="itemReviewed" itemscope itemtype="http://schema.org/ApartmentComplex"> 
    <div class="col-sm-12"> 
     <div class="page-header"> 
    <h1><span itemprop="name">T Park </span></h1> 
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" class="address"> 
     <span itemprop="streetAddress">1 Scenic Park</span> 
     <span itemprop="postalCode" class="hidden">123456</span> 
     <span itemprop="addressRegion" class="hidden">Central</span> 
     <span itemprop="addressCountry" class="hidden">Singapore</span> 
    </div> 
     </div> 
    </div> 
    </div> 
    <div style="margin-bottom:0px;" class="jumbotron row"> 
    <h2>T Park Reviews</h2> 
    <br> 
    <div id="reviews" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> 
     <meta itemprop="worstRating" content="1"> 
     <meta itemprop="ratingValue" content="9"> 
     <meta itemprop="bestRating" content="10"><span>Rating: 9/10</span> 
    </div> 
    <br><span itemprop="reviewBody">Lorem Ipsum....</span> 
    <br><strong itemprop="author" class="row pull-right">John May</strong> 
    </div> 
</div> 
+0

这似乎是一种有效的方式。我刚刚测试并发现,在“并行”中使用ApartmentComplex和Review似乎也起作用。你认为哪种方法更好? – rgareth 2014-10-12 20:25:58

+0

任何一种方式听起来都有效 – 2014-10-13 08:50:08