【问题标题】:How does Google treat webpages with multiple JSON-LD Schema.org blocks?Google 如何处理具有多个 JSON-LD Schema.org 块的网页?
【发布时间】:2019-04-29 19:42:38
【问题描述】:

Google 等搜索引擎如何处理包含多个 JSON-LD (Schema.org) 块的网页?

例如,如果页面下方有两个不冲突的script 块会怎样?

<script type="application/ld+json">
{   "@context":"http://schema.org",    
    "@type":"WebPage",
    "@id": "#123",
    "author": {
      "@type": "Person",
      "name": "Foo Bar"
    }
}
</script>
<script type="application/ld+json">
{   "@context":"http://schema.org",
    "@type":"WebPage",
    "@id": "#123",
    "text": "blah blah blah",
    "url":"pageurl"
  }
</script>

【问题讨论】:

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


    【解决方案1】:

    我们无法知道 Google 搜索实际上是如何处理它们的,但我们可以知道 Google’s Structured Data Testing Tool 是如何处理这种情况的。

    相同的 URI

    如果对象具有相同的 URI(在 JSON-LD 中:@id),则它们相同的。 Google 的 SDTT 将显示一个条目,显示来自具有相同 URI 的所有对象的属性。所以从 SDTT 中的输出来看,Google 似乎对这两种情况一视同仁:

    <script type="application/ld+json">
    {   "@context":"http://schema.org",    
        "@type":"WebPage",
        "@id": "#123",
        "url":"pageurl",
        "text": "blah blah blah"
    }
    </script>
    
    <script type="application/ld+json">
    {   "@context":"http://schema.org",    
        "@type":"WebPage",
        "@id": "#123",
        "url":"pageurl"
    }
    </script>
    <script type="application/ld+json">
    {   "@context":"http://schema.org",
        "@type":"WebPage",
        "@id": "#123",
        "text": "blah blah blah"
    }
    </script>
    

    不同(或没有)URI

    默认假设是对象描述不同的事物。但是,如果某些(通常是唯一的)属性具有相同的值(电话、地址、姓名等),那么像 Google 搜索这样的消费者可能会推断出这些对象描述的是相同的东西——这不是标准化的,但是,以及消费者是否/何时这样做并没有记录。

    【讨论】:

    • 根据经验,Googlebot 也会在 id 匹配时进行合并。我们经常设置 ids 来解析重复的实体,它改进了丰富的 sn-ps。例如价格和评论星显示它们何时在不同的脚本中定义。
    • @TonyMcCreath:你的意思是 HTML id 属性吗?如果是,我知道 Google 的 SDTT 是 (I think) bugged,因为它会从该属性生成(错误的)URI——但这只会影响 Microdata/RDFa,而不是 JSON-LD。还是我错过了什么?
    • 在微数据中它是一个 itemid 属性。在 json-ld 中它的“@id”。如果它们不存在,那么 SDTT 会根据 url 和相关的 id 属性(如果我没记错的话)来弥补它们。
    猜你喜欢
    • 2015-08-10
    • 2018-05-26
    • 2018-09-17
    • 2020-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多