首页 > 解决方案 > Schema.org 的“专业”属性因问答类型而失败:“Google 无法识别问题类型的对象的属性专业。”

问题描述

我正在尝试添加specialty属性,遵循使用 JSON-LD 的 Schema.org 文档。根据QAPage文档,specialty确实是此模式类型的有效值。

问题是当我使用 Google 的结构化数据测试工具进行验证时,它会吐出这个错误:

specialtyGoogle 无法识别类型对象的属性Question。)

现在,Schema.org 部分由 Google 运营,所以我不认为这是他们的错误。很确定它可能是 JSON-LD 语法,但我整个早上都在尝试不同的东西。任何人都可以阐明这个问题吗?

{
"@context": "https://schema.org",
"@type": "QAPage",
"mainEntity": {
  "@type": "Question",
  "name": "How many ounces are there in a pound?",
  "text": "I have taken up a new interest in baking and keep running across directions in ounces and pounds. I have to translate between them and was wondering how many ounces are in a pound?",
  "specialty": "SEO",   //ISSUE LINE 
  "answerCount": 3,
  "upvoteCount": 26,
  "dateCreated": "2016-07-23T21:11Z",
  "author": {
    "@type": "Person",
    "name": "New Baking User"
  },
  "acceptedAnswer": {
    "@type": "Answer",
    "text": "1 pound (lb) is equal to 16 ounces (oz).",
    "dateCreated": "2016-11-02T21:11Z",
    "upvoteCount": 1337,
    "url": "https://example.com/question1#acceptedAnswer",
    "author": {
      "@type": "Person",
      "name": "SomeUser"
    }
  },
  "suggestedAnswer": [
    {
      "@type": "Answer",
      "text": "Are you looking for ounces or fluid ounces? If you are looking for fluid ounces there are 15.34 fluid ounces in a pound of water.",
      "dateCreated": "2016-11-02T21:11Z",
      "upvoteCount": 42,
      "url": "https://example.com/question1#suggestedAnswer1",
      "author": {
        "@type": "Person",
        "name": "AnotherUser"
      }
    }, {
      "@type": "Answer",
      "text": " I can't remember exactly, but I think 18 ounces in a lb. You might want to double check that.",
      "dateCreated": "2016-11-06T21:11Z",
      "upvoteCount": 0,
      "url": "https://example.com/question1#suggestedAnswer2",
      "author": {
        "@type": "Person",
        "name": "ConfusedUser"
      }
    }
  ]
}
}

标签: schema.orgjson-ldgoogle-rich-snippets

解决方案


specialty属性需要添加到WebPage(或其子类型之一,如QAPage)。

您将其添加到Question未列出的位置)。


推荐阅读