0

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

在调试 html 后,我发现以下代码片段在输入到 Rich Snippets Testing Tool 时成功显示了丰富的代码片段。

  <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 的,并且我想包含对它的评论,我应该如何构建/嵌套这个标记?

4

1 回答 1

1

我认为您的标记或微数据没有任何问题。我只是不认为 Google 结构化数据工具显示任何http://schema.org/ApartmentComplex类型的丰富片段 - 丰富片段仅适用于某些 schema.org 类型。

为了证明这一点,将包装的 ApartmentComplex 类型更改为 Product 类型,并删除地址(它不是“产品”的一部分),您会看到在 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>
于 2014-10-08T20:25:52.963 回答