页面上有多个(相同类型)模式对象-是否可以为所有模式对象设置一个属性,而不必为每个对象重复该属性?

时间:2019-05-24 18:02:38

标签: schema.org json-ld

我正在为一个新的站点设置结构化数据,该站点发布了产品的购买者指南。这些指南将采用文章的形式,每篇文章大约包含10个项目,我正在使用ItemList为指南中的每个产品实现Review模式。由于这是一篇文章,因此我还将在每本指南上实现文章架构,以利用Google丰富的搜索功能来查找文章(例如热门故事)。

我在我的Article模式中使用了“ author”属性,但是Review模式的最佳实践还建议使用“ author”属性。有什么方法可以从审阅模式引用或链接“文章”模式中的“作者”人?否则,我将不得不在每个Review模式中重复相同的“作者”信息,这似乎是多余的。

我尝试将我的itemListElements数组嵌套在Article模式中,但是Google无法识别该格式。我还尝试将author属性添加到我的ItemList架构中,但再次说明该架构类型的Google无法识别该属性。我知道有标识符属性@id,但是我不确定如何正确使用它或它是否适用于我的问题。我在“文章”架构中将其添加到“作者”人员中,但是如何在“审阅”架构中引用它,甚至可以解决我的问题?

这是我的代码。当前,我在Article模式中使用完整的作者信息,然后仅在Review模式元素中使用名称(字符串)。如我之前所说,我尝试过几件事在Google's Structured Data testing tool上生成了警告。以下是我在工具上进行验证时得到的最干净的版本。

  <script type="application/ld+json">
  {
    "@context": "https://schema.org/",
    "@type": "Article",

    "mainEntityOfPage": {
                  "@type": "WebPage",
                  "@id": "https://example.com/best-large-camping-tents"
                },
    "headline": "10 Best Large Camping Tents",
    "image":{
                  "@type": "ImageObject",
                  "url": "https://example.com/public/build/images/best-large-camping-tents.jpg",
                  "height":700 ,
                  "width":1400
                },
    "datePublished": "May 23, 2019 14:57",
    "dateModified": "May 23, 2019 14:57",
    "author": {
                  "@type": "Person",
                  "@id": "https://example.com/author/phillipb/#author",
                  "name": "Phillip B",
                  "sameAs":[
                      "https://example.com/author/phillipb/",
                      "https://twitter.com/phillipb"
                      ]
                },
    "publisher": {
                  "@type": "Organization",
                  "name": "My Product Review Site",
                  "logo": {
                    "@type": "ImageObject",
                    "url": "https://example.com/public/build/images/my-site-logo.png",
                    "height":60,
                    "width":458
                  }
                },
    "description": "We found the 10 best large camping tents, perfect for the casual camper or the avid outdoorsman.",
    "aggregateRating": {
                "@type": "AggregateRating",
                "ratingValue": "88",
                "bestRating": "100",
                "worstRating": "1",
                "ratingCount": "20"
    }
  }
  </script> 
  <script type="application/ld+json">
  {
    "@context": "http://schema.org/",
    "@type": "ItemList",
    "name": "3 Best Large Camping Tents",
    "url": "https://www.example.com/best-large-camping-tents", 
    "itemListElement": [
      {
        "@type": "Product",
        "name": "ABC Camping Tent", 
        "url": "https://www.example.com/best-large-camping-tents/#abc-camping-tent",
        "description": "An affordable tent option for the casual camping hobbyist.", 
        "mainEntityOfPage": "https://amazon.com/abc-camping-tent-affiliate-link", 
        "image": { 
                "@type": "ImageObject", 
              "url": "https://example.com/public/build/images/abc-camping-tent-large.png",
              "height": 700,
              "width": 1400
        },
        "review": {
                "@type": "Review",
                "author": "Phillip B",
                "datePublished": "2019-04-01",
                "reviewRating": {
                  "@type": "Rating",
                  "bestRating": "5",
                  "ratingValue": "3",
                  "worstRating": "1"
              }
        }
      },
      {
        "@type": "Product",
        "name": "XYZ Camping Tent", 
        "url": "https://www.example.com/best-large-camping-tents/#xyz-camping-tent",
        "description": "A mid-scale camping tent big enough for the whole family.", 
        "mainEntityOfPage": "https://amazon.com/xyz-camping-tent-affiliate-link", 
        "image": { 
                "@type": "ImageObject", 
              "url": "https://example.com/public/build/images/xyz-camping-tent-large.png",
              "height": 700,
              "width": 1400
        },
        "review": {
                "@type": "Review",
                "author": "Phillip B",
                "datePublished": "2019-04-01",
                "reviewRating": {
                  "@type": "Rating",
                  "bestRating": "5",
                  "ratingValue": "4",
                  "worstRating": "1"
              }
        }
      },
      {
        "@type": "Product",
        "name": "PQR Camping Tent", 
        "url": "https://www.example.com/best-large-camping-tents/#pqr-camping-tent",
        "description": "The upper echelon of camping tents for the experiened hiker.", 
        "mainEntityOfPage": "https://amazon.com/pqr-camping-tent-affiliate-link", 
        "image": { 
                "@type": "ImageObject", 
              "url": "https://example.com/public/build/images/pqr-camping-tent-large.png",
              "height": 700,
              "width": 1400
        },
        "review": {
                "@type": "Review",
                "author": "Phillip B",
                "datePublished": "2019-04-01",
                "reviewRating": {
                  "@type": "Rating",
                  "bestRating": "5",
                  "ratingValue": "5",
                  "worstRating": "1"
              }
        }
      }
    ]
  }
  </script>

我希望必须有一种方法可以指示何时在同一页上的另一个架构中重用属性,但是到目前为止,我的尝试还没有奏效。一遍又一遍地重复相同的信息吗?

1 个答案:

答案 0 :(得分:0)

对于以后对作者的所有引用,您可以使用:

"author": {"@id": "https://example.com/author/phillipb/#author"},

我不确定您所标记的内容是否符合Google的指南。

如果文章的作者也是评论的作者,那么似乎有些可疑吗?我敢肯定有一个指导方针,但是今天找不到。

https://developers.google.com/search/docs/guides/mark-up-listings
标记其他页面上的项目列表时,只应标记URL。

您还具有两个不相连的顶级实体。产品与本文的关系如何。文章有几种引用诸如产品之类的实体的方法。也许about