Google无法使用相同的URI ID在同一页面中正确合并微数据和json + ld

问题描述 投票:2回答:2

我有一个带有“微数据”和“ json + ld”代码的产品页面。这两个代码都引用相同的@id URI对象(http://www.example.org/product#this),因此我希望“混合/合并”这两个属性,但是结构化数据测试工具将显示2个“单个”产品,....

1- Google是否支持在同一页面中使用两种语法?2-实施得好吗?我可以使用微数据的itemId和json + ld的@id将两个代码引用到同一对象吗?3-就结构数据索引而言,这会损坏我的页面吗?

感谢

您可以在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>
schema.org microdata json-ld structured-data
2个回答
2
投票
我的猜测是Google的结构化数据测试工具不支持不同的语法,因为使用相同的语法似乎可以使用。但是,由于它们仍然正确显示URI(在两种情况下均为http://www.example.org/product#this),因此您可以说这只是工具的界面无法合并它们。但是,据我所知,Google仍然没有文档来支持这些主题URI(但这并不一定意味着它们不支持这些URI),因此对它们而言并不重要。

您的示例在使用http://linter.structured-data.org/时效果很好:它同时创建了两个品牌和两个要约的

one项目。


0
投票
虽然从技术上讲,合并来自两种不同语法(读取微数据和json-ld)的数据是可行的,并且结构化数据Linter证实了这一点,但Google

不支持它,这意味着不会合并属性(并且无法满足Rich Snippets的要求)。

我们对SEO世界中的几位参与者进行了最终确认,包括Dan BrickleyJarno van Driel

通常,您可以同时使用两种语法,但是

您不会通过ID

进行的三元组的细粒度合并,即纯RDF应用程序可能会预期(Dan Brickley,Twitter,2020年1月14日,bold mine)]-

我认为@danbri已经很清楚了。高度怀疑您会得到与其他Google员工的答案不同。 (Jarno van Driel于Twitter,2020年1月14日)

到目前为止,所提出的解决方案是解析微数据并将其发布为JSON-LD。

© www.soinside.com 2019 - 2024. All rights reserved.