3

How do search engines like Google treat webpages with multiple JSON-LD (Schema.org) blocks?

For example, what would happen if a page has both non-conflicting script blocks below?

<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>
unor
  • 92,415
  • 26
  • 211
  • 360

1 Answers1

2

We can’t know how Google Search actually treats them, but we can know how Google’s Structured Data Testing Tool handles such a case.

Same URI

If objects have the same URI (in JSON-LD: @id), they are the same. Google’s SDTT will display one entry showing properties from all objects with the same URI. So judging from the output in SDTT, Google seems to treat these two cases equally:

<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>

Output in Google’s SDTT

Different (or no) URI

The default assumption is that the objects describe different things. However, if certain (typically unique) properties have the same values (telephone, address, name etc.), a consumer like Google Search might deduce that the objects describe the same thing -- this is not standardized, though, and if/when consumers do this is not documented.

unor
  • 92,415
  • 26
  • 211
  • 360
  • From experience, Googlebot also does the merging when ids match. We've quite often set up ids to resolve duplicate entities, and it has improved rich snippets. e.g. price and review stars showing when they are defined in different scripts. – Tony McCreath Dec 05 '18 at 12:18
  • @TonyMcCreath: Do you mean the HTML `id` attribute? If yes, I know that Google’s SDTT is [(I think) bugged](https://stackoverflow.com/a/29492058/1591669) in the way that it generates a (wrong) URI from this attribute -- but this should only affect Microdata/RDFa, not JSON-LD. Or am I missing something? – unor Dec 05 '18 at 14:06
  • In microdata its an itemid attribute. In json-ld its "@id". If they are not present then the SDTT makes them up from the url and maybe a related id attribute (if I recall correctly). – Tony McCreath Dec 06 '18 at 15:10