使用 JSON-LD 更正事件列表的结构化数据格式

Correct structured data formatting for list of events with JSON-LD

我正在尝试为事件列表创建结构化数据。我目前有以下内容:

"@context": "http:\/\/schema.org",
"@type": "ItemList",
"name": "Forthcoming Shows",
"url": "http:\/\/example.com\/",
"itemListElement": [
    {
        "@type": "Event",
        "name": "test event",
        "startDate": "21\/07\/2020",
        "endDate": "24\/07\/2020",
        "description": "description here",
        "position": 1,
        "url": "http:\/\/example.com/",
        "location": [
            {
                "@type": "Place",
                "name": "Venue name",
                "address": "Venue address"
            }
        ]
    },
    etc
]

Google 的结构化数据测试工具对象到 位置 属性 位置不被 Google 识别为事件类型的对象,但如果我将其排除在工具对象之外,因为 需要位置字段的值。 我可以简单地使用 ListItem 作为类型,但是开始日期和结束日期无效,我更希望事件列表允许包含这些事件详细信息。 不幸的是,我找不到任何可供参考的事件列表或事件日历示例。 correct/best 结构是什么?

positionListItem 的 属性(不是事件的)。

要解决您的问题,您应该使用嵌套对象 (itemListElement > item (type event))。

基本大纲(缺少一些较短代码的属性):

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "ItemList",
  "name": "Basic list",
  "numberOfItems": 2,
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "item": {
        "@type": "event",
        "name": "hello"
      }
    },
    {
      "@type": "ListItem",
      "position": 2,
      "item": {
        "@type": "event",
        "name": "world"
      }
    }
  ]
}
</script>

“问题所在”

Add structured data to your event pages. Currently, the event experience on Google only supports pages that focus on a single event https://developers.google.com/search/docs/data-types/event

无论如何,您的标记可能看起来像这样(同样 google 支持此 rich results 到 2020 年 6 月为真):

<script type="application/ld+json">
  {
    "@context": "http://schema.org",
      "@type": "ItemList",
      "url": "http://hello.com",
      "numberOfItems": "2",
      "itemListElement": [
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Event One",
          "item": {
            "@type": "Event",
            "name": "If Not For You",
            "url": "http://hello.com#one",
            "startDate": "2025-07-21T19:00-05:00",
            "location": {
                "name": "Snickerpark Stadium",
                "address": "Paris"
            }
          }
        },/*item two*/
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Event Two",
          "item": {
            "@type": "Event",
            "name": "Event Two",
            "url": "http://hello.com#two",
            "startDate": "2025-07-21T19:00-05:00",
            "location": {
                "name": "Empire Stadium",
                "address": "London"
            }
          }
        }
      ]
  }
</script>

还有一个问题。 Google 使用非常接近 summary-page 的大纲(记住这一点):

Defines an ItemList, where each ListItem has only three properties: @type (set to "ListItem"), position (the position in the list), and url (the URL of a page with full details about that item https://developers.google.com/search/docs/data-types/carousel

The list for events is not supported by Google:

Each event MUST have a unique URL (a leaf page) and markup on that URL.