Google SDTT中的错误:"为网址提供的所有值都必须指向同一页面."

use*_*332 9 url schema.org json-ld google-rich-snippets

我正在尝试为ecom网站上的产品列表创建一些JSON-LD结构化数据,但是在使用Google的结构化数据测试工具时出现错误.

到目前为止,我有这个:

 {
 "@context": "http://schema.org",
 "@type": "OfferCatalog",
 "name": "Fresh Fruit",
 "itemListElement": [
  {
   "@type": "ListItem",
   "position": 1,
   "item":
   {
        "@type": "Offer",
        "price": "1.20",
        "priceCurrency": "GBP",
        "availability": "http://schema.org/InStock",
        "url": "http://example.com/green-apples/",
        "itemOffered": {
            "@type": "Product",
            "name": "Green Apples",
            "url": "http://example.com/green-apples/"
            }
        }        
   }  
 ]
}
Run Code Online (Sandbox Code Playgroud)

大多数情况下它会验证,但Google工具会抛出以下错误:

为url提供的所有值必须指向同一页面.

错误突出显示第11行("@type": "Offer",).

URL字段似乎与@context声明冲突,因为如果我将上下文更改为非url字符串或者http://example.com,它会验证(尽管这显然会导致其自身的问题).(这已被证明是一个红鲱鱼,在下面的评论中)

我在这里错过了什么?感觉就像是一件非常明显的事情.

Nic*_*ick 7

我认为它与推动加速移动页面及其结构化数据有关.

请在此处查看我的想法:为URL提供的所有值都必须指向同一页面.我的猜测是关于谷歌SDTT的问题

因此,要解决结构数据的问题,请使用正确版本的ItemList(有单独和组合标记的ItemLists,请在此处查看):

  • 如果您的商品位于同一页面上,请使用包含内部商品的版本,即合并商品.

  • 否则,如果您指向内部的不同页面并且您的项目不在一个页面上,请不要将带有类型和其他描述的项目元素放入其中,单独标记为一个.


Ada*_*ner 1

这肯定是验证器中的错误。我检查了谷歌提供的示例:https://developers.google.com/search/docs/guides/mark-up-listings。如果您单击第二个示例,您将看到它有相同的错误。

即使您使用 1 项,也会显示错误:

{
  "@context": "http://schema.org",
  "@type": "ItemList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "item": {
        "@type": "Recipe",
        "url": "http://example.com/desserts/pies/#apple-pie",
        "name": "Apple Pie",
        "image": "https://example.com/300px-Apple_pie.jpg",
        "author": {
          "@type": "Person",
          "name": "Carol Smith"
        },
        "datePublished": "2009-11-05"
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)