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

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

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

"@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 作为类型,但开始日期和结束日期无效,我宁愿希望事件列表允许包含这些事件详细信息。 不幸的是,我找不到任何事件列表或事件日历的示例可供参考。正确/最佳的结构是什么?

schema.org json-ld google-rich-snippets structured-data
3个回答
3
投票

position
ListItem
的属性(不是事件的属性)。

要解决您的问题,您应该使用嵌套对象(itemListElement > item(类型事件))。

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

<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>

“问题”

将结构化数据添加到您的活动页面。目前,该活动 Google 上的体验仅支持专注于单个事件的页面 https://developers.google.com/search/docs/data-types/event

无论如何,你的标记可能看起来像这样(再次谷歌

支持这个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

 轮廓(请记住这一点):

定义一个 ItemList,其中每个 ListItem

三个属性: @type(设置为“ListItem”)、position(列表中的位置)和 url (包含该项目完整详细信息的页面的 URL https://developers.google.com/search/docs/data-types/carousel


2
投票

Google 不支持事件列表:

每个事件必须有一个唯一的 URL(叶页面)和标记 网址。


0
投票
2023年现在有什么变化吗? 我需要标记一个剧院的模式、一个包含月份时间表的页面以及一个包含剧目中所有演出的页面? 最好的方法是什么?

© www.soinside.com 2019 - 2024. All rights reserved.