将本地业务与服务和区域服务模式结合在一起

问题描述 投票:0回答:1

当我在结构化数据测试工具中插入此代码时,我只会看到第一个架构。我可以切换服务区域的本地业务和服务的顺序,但是当我这样做时,工具中只会显示其中之一。当我尝试将两者拆分并单独获取时,会发生相同的事情。

使用json-ld脚本:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "ProfessionalService",
  "name": "Sebastian River Exterminating",
  "image": "http://sebastianriverexterminating.com/images/extermination-logo-sebastian-fl.png",
  "@id": "",
  "url": "http://sebastianriverexterminating.com/",
  "telephone": "7722289969",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "124 Salazar Lane",
    "addressLocality": "Sebastian",
    "addressRegion": "FL",
    "postalCode": "32958",
    "addressCountry": "US"
  },
  "geo": {
    "@type": "GeoCoordinates",
    "latitude": 27.7600115,
    "longitude": -80.50620599999999
  },
  "openingHoursSpecification": {
    "@type": "OpeningHoursSpecification",
    "dayOfWeek": [
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday"
    ],
    "opens": "08:00",
    "closes": "18:00"
  },
  "sameAs": "https://www.facebook.com/SebastianRiverExterminatingFL/timeline"
}
{
    "@context": "http://schema.org",
    "@type": "Service",
    "serviceType": "Exterminator",
    "additionalType": "https://en.wikipedia.org/wiki/Pest_control",
    "areaServed": [
        {
            "@type": "City",
            "name": "Sebastian",
            "@id": "https://en.wikipedia.org/wiki/Sebastian,_Florida"
        },
        {
            "@type": "City",
            "name": "Roseland",
            "@id": "https://en.wikipedia.org/wiki/Roseland,_Florida"
        }
    ]}
</script>
schema json-ld
1个回答
0
投票

无效的json或json-ld。您只能向每个脚本添加一个对象。例如

<script type="application/ld+json">
{
...
}
</script>

您不能像以前那样列出对象。

解决此问题的一种方法是将每个标签添加到自己的脚本标签中。

[另一种方法是使用@graph将它们添加为对象内的数组。例如

<script type="application/ld+json">
{
  "@graph": [
    {
      ...
    }, 
    {
      ...
    }
  ]
}
</script>
© www.soinside.com 2019 - 2024. All rights reserved.