如何在 schema.org 中使用 JSON-LD 写入有效的午休时间

How to write valid opening hours with lunch break in schema.org with JSON-LD

我在这里阅读了有关此主题的所有帖子,但找不到解决方案。

我正在为营业时间如下的企业创建页面:

周一至周五 07:00 - 12:00 和 13:00 - 17:00(1 小时午休时间)

我找不到一种方法来将此写成对我的 schema.org 标记有效的 JSON-LD。 Google 的富媒体搜索结果测试工具不接受我的想法,在 schema.org 文档中我找不到任何此类案例的示例。

没有午休时间的标准有效代码如下所示:

"openingHoursSpecification": {
    "@type": "OpeningHoursSpecification",
    "dayOfWeek": [
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday"
    ],
    "opens": "07:00",
    "closes": "17:00"
  },

我想要的代码有这样的代码,但我无法验证它,也找不到任何示例来说明它是如何完成的。

"openingHoursSpecification": {
    "@type": "OpeningHoursSpecification",
    "dayOfWeek": [
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday"
    ],
    "opens": "07:00",
    "closes": "12:00",
    "opens": "13:00",
    "closes": "17:00"
  },

架构具有 属性 specialOpeningHoursSpecification

The special opening hours of a certain place. Use this to explicitly override general opening hours brought in scope by openingHoursSpecification or openingHours.

我对午餐加价的建议:

<script type="application/ld+json">
  {
"@context":"https://schema.org",
  "@type":"Restaurant",
    "name":"GreatFood",
      "openingHoursSpecification":{
        "@type":"OpeningHoursSpecification",
          "dayOfWeek":[
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday"
          ],
            "opens":"07:00",
              "closes":"17:00"
      },
        "specialOpeningHoursSpecification":{
          "@type":"OpeningHoursSpecification",
            "dayOfWeek":[
              "Monday",
              "Tuesday",
              "Wednesday",
              "Thursday",
              "Friday"
            ],
              "closes": "12:00",
                "opens": "13:00"
        }
  }
</script>

我没能找到这个 属性 的官方例子。我对文档中关于类型 OpeningHoursSpecification:

的以下说法感到困惑

If the value for the closes property is less than the value for the opens property then the hour range is assumed to span over the next day.

Schema 文档没有明确说明 属性 openingHoursSpecification 是如何计算的。因此,我不知道搜索引擎将如何理解它。也许最好的解决方案是创建一个实验并分析结果。

在这些较旧的 post 中使用 hoursAvailable 的解决方案似乎有效。使用 Google 的测试工具进行测试:

原文Post:

原始代码post:

{
    "@context": "http://schema.org",
    "@type": "Service",
    "url": "http://www.example.com/",
    "hoursAvailable": [{
        "@type": "OpeningHoursSpecification",
        "opens": "08:00",
        "closes": "13:00",
        "dayOfWeek": [{
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Monday",
            "name": "Monday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Tuesday",
            "name": "Tuesday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Wednesday",
            "name": "Wednesday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Thursday",
            "name": "Thursday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Friday",
            "name": "Friday"
        }]
    },
    {
        "@type": "OpeningHoursSpecification",
        "opens": "15:00",
        "closes": "20:00",
        "dayOfWeek": [{
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Monday",
            "name": "Monday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Tuesday",
            "name": "Tuesday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Wednesday",
            "name": "Wednesday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Thursday",
            "name": "Thursday"
        },
        {
            "@type": "DayOfWeek",
            "@id": "http://schema.org/Friday",
            "name": "Friday"
        }]
    }]
}