架构:列出嵌套对象时是否有必要(甚至建议)重复结构化数据?

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

我们正在为一个1页的网站处理JSON结构化数据。这单个页面提供了有关本地业务的大量数据(包括地址,价格,评论,服务等)。我们将其作为业务本身的结构化数据的json:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "localbusiness",
  "name": "Example Business",
  "url": "https://www.example.com/",
  "logo": "https://www.example.com/logo.jpg",
  "areaServed": {
    "@type": "City",
    "name": "New York"
  },
  "image": "https://www.example.com/image.jpg",
  "description": "Good description of example business",
  "telephone": "+123456789",
  "priceRange": "$$$",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "101 Main Road",
    "addressLocality": "Hereabouts",
    "addressRegion": "New York",
    "postalCode": "AB123456",
    "addressCountry": "US"
  },
  "aggregateRating": {
   "@type": "AggregateRating",
     "ratingValue": "4.95",
     "reviewCount": "100"
  },
  "openingHoursSpecification": [
  {
    "@type": "OpeningHoursSpecification",
    "dayOfWeek": [
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday"
    ],
    "opens": "09:00",
    "closes": "17:00"
  }
  ],
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "+123456789",
    "contactType": "Sales"
  }
}
</script>

我们还希望为页面上提供和列出的服务添加结构化数据:

<script type='application/ld+json'> 
  {
  "@context": "https://www.schema.org",
  "@type": "Service",
  "serviceType": "The Main Services",
  "provider": {
  "@type": "localbusiness",
  "name": "Example Business",
  "url": "https://www.example.com/",
  "logo": "https://www.example.com/logo.jpg",
  "areaServed": {
    "@type": "City",
    "name": "New York"
  },
  "image": "https://www.example.com/image.jpg",
  "description": "Good description of example business",
  "telephone": "+123456789",
  "priceRange": "$$$",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "101 Main Road",
    "addressLocality": "Hereabouts",
    "addressRegion": "New York",
    "postalCode": "AB123456",
    "addressCountry": "US"
  },
  "hasOfferCatalog": {
    "@type": "OfferCatalog",
    "name": "The Main Services",
    "itemListElement": [
      {
        "@type": "OfferCatalog",
        "name": "First Main Services",
        "itemListElement": [
          {
            "@type": "Offer",
            "itemOffered": {
              "@type": "Service",
              "name": "Service 1A",
			  "url": "https://www.example.com/service1A"
            }
          },
          {
            "@type": "Offer",
            "itemOffered": {
              "@type": "Service",
              "name": "Service 1B",
			  "url": "https://www.example.com/service1B"
            }
          },
          {
            "@type": "Offer",
            "itemOffered": {
              "@type": "Service",
              "name": "Service 1C",
			  "url": "https://www.example.com/service1C"
            }
          }
        ]
	},
    {
        "@type": "OfferCatalog",
        "name": "Second Main Services",
        "itemListElement": [
          {
            "@type": "Offer",
            "itemOffered": {
              "@type": "Service",
              "name": "Service 2A",
			  "url": "https://www.example.com/service2A"
            }
          },
          {
            "@type": "Offer",
            "itemOffered": {
              "@type": "Service",
              "name": "Service 2B",
			  "url": "https://www.example.com/service2B"
            }
          },
          {
            "@type": "Offer",
            "itemOffered": {
              "@type": "Service",
              "name": " 2C",
			  "url": "https://www.example.com/service2C"
            }
          }
        ]}
    ]
  }
}
}
 </script>

我的问题是关于服务“提供者”部分的。在这一部分中,我必须重复第一个脚本中“ localbusiness” @type中的许多数据。

如果我随后要重复“服务”脚本中的数据(就Google而言,是否必须同时拥有“ localbusiness”(第一个脚本)?

我可以改为删除第一个脚本,然后将所有信息放入服务中吗?当Google寻找有关企业本身的结构化数据时,他们能够从那里获取并使用本地企业数据吗?

[另外,当我开始添加评论数据时,我将需要再次将localbusiness作为“ itemreviewed”属性包含在内,这意味着我将再次重复所有操作!基本上,我将为每条评论重复“本地企业”数据。这真的开始看起来有点垃圾邮件。

任何人都可以帮助阐明Google如何查看此数据以及应存储或重复存储多少数据?

html json schema google-rich-snippets structured-data
1个回答
0
投票

您一次可以详述一个实体,并包含一个@id。

然后,您可以在引用同一实体的位置引用该@id。这省去了重复所有数据的必要,节省了空间,并有助于阐明所有地方都在谈论同一件事。

e.g。

"provider": {
  "@type": "LocalBusiness",
  "@id": "https://example.com/#LocalBusiness"
}
© www.soinside.com 2019 - 2024. All rights reserved.