Google SDTT 中的错误:“为 url 提供的所有值必须指向同一页面." [英] Error in Google SDTT: "All values provided for url must point to the same page."

查看:14
本文介绍了Google SDTT 中的错误:“为 url 提供的所有值必须指向同一页面."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to create some JSON-LD structured data for a list of products on an ecom-site but I am getting an error when using Google's Structured Data Testing Tool.

到目前为止,我有这个:

So far, I have this:

 {
 "@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/"
            }
        }        
   }  
 ]
}

主要是通过验证,但 Google 工具会引发以下错误:

Mostly it validates, but the Google tool throws the following error:

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

All values provided for url must point to the same page.

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

The error highlights line 11 ("@type": "Offer",).

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

The URL fields seem to be clashing with the @context declaration, because if I change the context to either a non-url string or http://example.com, it validates (although, this obviously causes its own issues). (This has been shown to be a red-herring, in the comments below)

我在这里错过了什么?感觉就像是非常明显的东西.

What am I missing here? It feels like something blindingly obvious.

推荐答案

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

It is surely an error in the validator. I checked with the examples google provided: https://developers.google.com/search/docs/guides/mark-up-listings . If you click on the 2nd example you will see that it has the same error.

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

The error is shown even if you use 1 item:

{
  "@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"
      }
    }
  ]
}

这篇关于Google SDTT 中的错误:“为 url 提供的所有值必须指向同一页面."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆