结构化数据测试工具与标记测试器中的不同验证结果

Different validation results in Structured Data Testing Tool versus Markup Tester

所以我有以下 JSON-LD 标记,它通过标记测试器 (https://www.google.com/webmasters/markup-tester/) with no errors but fails the Structured data testing tool (https://developers.google.com/structured-data/testing-tool/) "ContactPoint must be attached to a parent with a declared type."

据我所知,我的 ContactPoint 已附加到我的 GovernmentService 对象。有什么我没看到的地方吗?

<script type='application/ld+json'>
{
  "@context": "http://schema.org",
  "@type": "GovernmentService",
  "name": "Jibber Jabber",
  "serviceType": "Jabber Application",
  "description": "The Jibber Jabber application is tired of you Jibber jabber!",
  "availableChannel": {
    "@type": "ServiceChannel",
    "serviceUrl": "http://rustled.jimmies.com/",
Error-->"servicePhone":  {
      "@type" : "ContactPoint",
      "telephone" : "+1505890897",
      "name" : "Jabber phone service",
      "contactType": "customer support"
    }
  },
  "url": "http://jibjab.rustled.jimmies.com",
  "provider": {
    "@type": "GovernmentOrganization",
    "name": "Jibbering and Howling",
    "url": "http://desertbluffs.state.az.gov",
    "logo": "http://desertbluffs.state.az.gov/Eagle.gif"
  }
}
</script>

您的 JSON-LD 似乎是正确的,您对 Schema.org 的使用似乎是合适的:

  1. GovernmentService 可以有 availableChannel 属性
  2. availableChannel 期望 ServiceChannel
  3. ServiceChannel 可以有 servicePhone 属性
  4. servicePhone 期望 ContactPoint

这个最小的 JSON-LD 在 Google 的 SDTT 中给出了同样的错误:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "GovernmentService",
  "availableChannel": {
    "@type": "ServiceChannel",
    "servicePhone":  {
      "@type" : "ContactPoint" 
    }
  }
}
</script>

错误消息指的是 Google 的知识图谱功能 Corporate Contacts. Unless I’m missing something, this seems to be one of the many cases where an error in Google’s tool 您的标记是错误的。