使用角色的hasOccupation对象数组的SDTT错误:“ hasOccupation不是hasOccupation属性的已知有效目标类型”

时间:2018-07-06 21:16:03

标签: schema.org json-ld

根据Schema.org's Occupation example 4,使用JSON-LD语法和Schema.org vocab,以下内容应有效,但无效。

{
    "@context": "http://schema.org",
    "@type": "Person",
    "name": "Jane Smith",
    "sameAs": "http://en.wikipedia.org/wiki/Jane_Smith",
    "worksFor": {
        "@type": "Organization",
        "name": "McKinsey & Company",
        "url" : "http://www.mckinsey.com"
    },
    "hasOccupation": [ {
          "@type": "Role",
          "hasOccupation": {
            "name": "Management Consultant"
          },
          "startDate": "2016-04-21"
        }, {
          "@type": "Role",
          "hasOccupation": {
            "name": "Chief Strategic Officer"
          },
          "startDate": "2013-11-14",
          "endDate": "2016-03-22"
        }, {
          "@type": "Role",
          "hasOccupation": {
            "name": "Vice President of Sales"
          },
          "startDate": "2009-09-20",
          "endDate": "2013-10-14"
        }
    ]
}

通过Google的Structured Data Testing Tool

  

hasOccupation 不是hasOccupation属性的有效目标类型。

1 个答案:

答案 0 :(得分:0)

您没有在Role内提供Occupation值的类型。它期望一个"hasOccupation": { "name": "Management Consultant" } 值。

所以这个

"hasOccupation": {
  "@type": "Occupation",
  "name": "Management Consultant"
}

应该变成这个

{{1}}

(与其他情况相同。)