-->

Google does not correctly merge microdata and json

2019-01-20 17:17发布

问题:

I have a product page with "microdata" and "json+ld" codes. Both of the codes refers to the same @id URI object (http://www.example.org/product#this) so I would expect to "mix/merge" both properties, but instead structured data testing tool shows 2 "individual" products so....

1- Does Google support using two syntax in the same page?
2- Is this well implemented? Can I refer two codes to the same object using itemId for microdata and @id for json+ld?
3- Can this damage my page in terms of structure data indexing?

thanks

You can check it out using this code in test tool:

<div itemscope itemtype="http://schema.org/Product" itemid="http://www.example.org/product#this">
    <a itemprop="url" href="http://www.example.org/product">
    <div itemprop="name"><strong>Product Name</strong></div></a>
    <div itemprop="description">Product Description</div>
    <div itemprop="brand" itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Product Brand</span></div>
    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">        <span itemprop="price">100</span><link itemprop="itemCondition" href="http://schema.org/NewCondition" /> New</div>
</div>
<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@id": "http://www.example.org/product#this",
  "name": "Product Name",
  "@type": "Product",
  "image": "http://www.example.com/anvil_executive.jpg",
  "mpn": "925872",
  "brand": {
    "@type": "Thing",
    "name": "ACME"
  },
  "offers": {
    "@type": "Offer",
    "priceCurrency": "USD",
    "price": "119.99",
    "itemCondition": "http://schema.org/UsedCondition",
    "availability": "http://schema.org/InStock"
  }
}
</script>

回答1:

My guess would be that Google’s Structured Data Testing Tool doesn’t support this for different syntaxes, as it seems to work if using the same syntax. But as they still display the URIs correctly (http://www.example.org/product#this in both cases), you could argue that it’s just the tool’s interface that doesn’t merge them.
However, as far as I know Google does not document to support these subject URIs anyway (but this doesn’t necessarily mean that they don’t support it), so it might not matter for them.

Your example works fine if using http://linter.structured-data.org/: it creates one item with both brands and both offers.