schema.org标记和嵌套用于审查" ApartmentComplex"

时间:2014-10-08 19:49:29

标签: schema.org rich-snippets google-rich-snippets

我在我的网站上使用微数据实现了一些结构化数据,以便谷歌和其他搜索引擎可以解析它并显示适当的丰富网页摘要。我为我使用过的所有微数据标记添加了相应的标记,但是在使用Rich Snippets测试工具测试时,我无法查看我网站的丰富网页摘要。我已经阅读了Google网站管理员的使用指南和常见问题部分,但无济于事。

在调试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 个答案:

答案 0 :(得分:1)

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

要证明这一点,请将包装的ApartmentComplex类型更改为“产品类型”,然后删除该地址(不属于“产品”),您将看到生成了丰富的代码片段 在Google结构化数据测试工具中(因为Google确实显示了丰富的产品代码段)。

编辑添加:这是一种可行的解决方法 - Google 显示schema.org类型的丰富网页摘要,其中周围类型为Review,因此您可以将Review用作顶级类型,然后将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>