Javascript Google的事件片段在富结果测试中仅显示一个事件
我想使用Google的事件片段在Google上显示我的事件,我发现的所有示例仅在显示一个事件时显示示例,而在片段上显示多个事件 下面是一个示例代码,它不是真实的数据,但我正在用它进行测试,以了解如何实现多个事件Javascript Google的事件片段在富结果测试中仅显示一个事件,javascript,json-ld,google-rich-snippets,rich-snippets,Javascript,Json Ld,Google Rich Snippets,Rich Snippets,我想使用Google的事件片段在Google上显示我的事件,我发现的所有示例仅在显示一个事件时显示示例,而在片段上显示多个事件 下面是一个示例代码,它不是真实的数据,但我正在用它进行测试,以了解如何实现多个事件 《奇拉与莫里森历险记》事件一 《奇拉与莫里森历险记》事件二 《奇拉与莫里森历险记》事件三 下面的代码在我测试它时通过,但只显示一个事件,而它应该显示所有这些事件 下面是使用Javascript-json+ld格式的代码片段,如果有人能帮我解决这个问题,使它能够显示所有三个事件,我将
- 《奇拉与莫里森历险记》事件一
- 《奇拉与莫里森历险记》事件二
- 《奇拉与莫里森历险记》事件三
<html>
<head>
<title>The Adventures of Kira and Morrison</title>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Event",
"name": "The Adventures of Kira and Morrison EVENT ONE",
"startDate": "2025-07-21T19:00-05:00",
"endDate": "2025-07-21T23:00-05:00",
"eventStatus": "https://schema.org/EventCancelled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Snickerpark Stadium",
"address": {
"@type": "PostalAddress",
"streetAddress": "100 West Snickerpark Dr",
"addressLocality": "Snickertown",
"postalCode": "19019",
"addressRegion": "PA",
"addressCountry": "US"
}
},
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "The Adventures of Kira and Morrison is coming to Snickertown in a can't miss performance.",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/event_offer/12345_201803180430",
"price": "30",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2024-05-21T12:00"
},
"performer": {
"@type": "PerformingGroup",
"name": "Kira and Morrison"
},
"organizer": {
"@type": "Organization",
"name": "Kira and Morrison Music",
"url": "https://kiraandmorrisonmusic.com"
}
},
{
"@context": "https://schema.org",
"@type": "Event",
"name": "The Adventures of Kira and Morrison EVENT TWO",
"startDate": "2025-08-21T19:00-05:00",
"endDate": "2025-08-21T23:00-05:00",
"eventStatus": "https://schema.org/EventCancelled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Snickerpark Stadium",
"address": {
"@type": "PostalAddress",
"streetAddress": "100 West Snickerpark Dr",
"addressLocality": "Snickertown",
"postalCode": "19019",
"addressRegion": "PA",
"addressCountry": "US"
}
},
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "The Adventures of Kira and Morrison is coming to Snickertown in a can't miss performance.",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/event_offer/12345_201803180430",
"price": "30",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2024-05-21T12:00"
},
"performer": {
"@type": "PerformingGroup",
"name": "Kira and Morrison"
},
"organizer": {
"@type": "Organization",
"name": "Kira and Morrison Music",
"url": "https://kiraandmorrisonmusic.com"
}
},
{
"@context": "https://schema.org",
"@type": "Event",
"name": "The Adventures of Kira and Morrison EVENT THREE",
"startDate": "2025-09-21T19:00-05:00",
"endDate": "2025-09-21T23:00-05:00",
"eventStatus": "https://schema.org/EventCancelled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Snickerpark Stadium",
"address": {
"@type": "PostalAddress",
"streetAddress": "100 West Snickerpark Dr",
"addressLocality": "Snickertown",
"postalCode": "19019",
"addressRegion": "PA",
"addressCountry": "US"
}
},
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "The Adventures of Kira and Morrison is coming to Snickertown in a can't miss performance.",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/event_offer/12345_201803180430",
"price": "30",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2024-05-21T12:00"
},
"performer": {
"@type": "PerformingGroup",
"name": "Kira and Morrison"
},
"organizer": {
"@type": "Organization",
"name": "Kira and Morrison Music",
"url": "https://kiraandmorrisonmusic.com"
}
}
</script>
</head>
<body>
</body>
</html>
基拉和莫里森历险记
{
“@context”:”https://schema.org",
“@type”:“事件”,
“名称”:“奇拉和莫里森历险记事件一”,
“起始日期”:“2025-07-21T19:00-05:00”,
“结束日期”:“2025-07-21T23:00-05:00”,
“事件状态”:https://schema.org/EventCancelled",
“eventAttendanceMode”:https://schema.org/OfflineEventAttendanceMode",
“地点”:{
“@type”:“Place”,
“名称”:“斯尼克公园体育场”,
“地址”:{
“@type”:“PostalAddress”,
“街道地址”:“100西斯尼克帕克博士”,
“地址地点”:“斯尼克镇”,
“postalCode”:“19019”,
“地址区域”:“PA”,
“地址国家”:“美国”
}
},
“图像”:[
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
“描述”:“Kira和Morrison的冒险故事将在一场不容错过的演出中来到Snickertown。”,
“提议”:{
“@type”:“Offer”,
“url”:”https://www.example.com/event_offer/12345_201803180430",
“价格”:“30”,
“价格货币”:“美元”,
“可用性”:https://schema.org/InStock",
“生效日期”:“2024-05-21T12:00”
},
“表演者”:{
“@type”:“PerformingGroup”,
“姓名”:“Kira和Morrison”
},
“组织者”:{
“@type”:“组织”,
“名字”:“基拉和莫里森音乐”,
“url”:”https://kiraandmorrisonmusic.com"
}
},
{
“@context”:”https://schema.org",
“@type”:“事件”,
“名称”:“奇拉和莫里森历险记事件二”,
“起始日期”:“2025-08-21T19:00-05:00”,
“结束日期”:“2025-08-21T23:00-05:00”,
“事件状态”:https://schema.org/EventCancelled",
“eventAttendanceMode”:https://schema.org/OfflineEventAttendanceMode",
“地点”:{
“@type”:“Place”,
“名称”:“斯尼克公园体育场”,
“地址”:{
“@type”:“PostalAddress”,
“街道地址”:“100西斯尼克帕克博士”,
“地址地点”:“斯尼克镇”,
“postalCode”:“19019”,
“地址区域”:“PA”,
“地址国家”:“美国”
}
},
“图像”:[
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
“描述”:“Kira和Morrison的冒险故事将在一场不容错过的演出中来到Snickertown。”,
“提议”:{
“@type”:“Offer”,
“url”:”https://www.example.com/event_offer/12345_201803180430",
“价格”:“30”,
“价格货币”:“美元”,
“可用性”:https://schema.org/InStock",
“生效日期”:“2024-05-21T12:00”
},
“表演者”:{
“@type”:“PerformingGroup”,
“姓名”:“Kira和Morrison”
},
“组织者”:{
“@type”:“组织”,
“名字”:“基拉和莫里森音乐”,
“url”:”https://kiraandmorrisonmusic.com"
}
},
{
“@context”:”https://schema.org",
“@type”:“事件”,
“名称”:“奇拉和莫里森历险记事件三”,
“起始日期”:“2025-09-21T19:00-05:00”,
“结束日期”:“2025-09-21T23:00-05:00”,
“事件状态”:https://schema.org/EventCancelled",
“eventAttendanceMode”:https://schema.org/OfflineEventAttendanceMode",
“地点”:{
“@type”:“Place”,
“名称”:“斯尼克公园体育场”,
“地址”:{
“@type”:“PostalAddress”,
“街道地址”:“100西斯尼克帕克博士”,
“地址地点”:“斯尼克镇”,
“postalCode”:“19019”,
“地址区域”:“PA”,
“地址国家”:“美国”
}
},
“图像”:[
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
“描述”:“Kira和Morrison的冒险故事将在一场不容错过的演出中来到Snickertown。”,
“提议”:{
“@type”:“Offer”,
“url”:”https://www.example.com/event_offer/12345_201803180430",
“价格”:“30”,
“价格货币”:“美元”,
“可用性”:https://schema.org/InStock",
“生效日期”:“2024-05-21T12:00”
},
“表演者”:{
“@type”:“PerformingGroup”,
“姓名”:“Kira和Morrison”
},
“组织者”:{
“@type”:“组织”,
“名字”:“基拉和莫里森音乐”,
“url”:”https://kiraandmorrisonmusic.com"
}
}
我找到了解决方案,事实上这很容易,但有时有些事情很难解决,因为我在互联网上找不到关于这一点的参考资料。我看到的几乎所有示例都在其示例中显示了一个事件
多个事件被包装在方括号中[]
,只有这样它们才能正确显示
下面的代码工作正常,但在我的实际代码中很少有可选的警告
<html>
<head>
<title>The Adventures of Kira and Morrison</title>
<script type="application/ld+json">
[{
"@context": "https://schema.org",
"@type": "Event",
"name": "The Adventures of Kira and Morrison EVENT ONE",
"startDate": "2025-07-21T19:00-05:00",
"endDate": "2025-07-21T23:00-05:00",
"eventStatus": "https://schema.org/EventCancelled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Snickerpark Stadium",
"address": {
"@type": "PostalAddress",
"streetAddress": "100 West Snickerpark Dr",
"addressLocality": "Snickertown",
"postalCode": "19019",
"addressRegion": "PA",
"addressCountry": "US"
}
},
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "The Adventures of Kira and Morrison is coming to Snickertown in a can't miss performance.",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/event_offer/12345_201803180430",
"price": "30",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2024-05-21T12:00"
},
"performer": {
"@type": "PerformingGroup",
"name": "Kira and Morrison"
},
"organizer": {
"@type": "Organization",
"name": "Kira and Morrison Music",
"url": "https://kiraandmorrisonmusic.com"
}
},
{
"@context": "https://schema.org",
"@type": "Event",
"name": "The Adventures of Kira and Morrison EVENT TWO",
"startDate": "2025-08-21T19:00-05:00",
"endDate": "2025-08-21T23:00-05:00",
"eventStatus": "https://schema.org/EventCancelled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Snickerpark Stadium",
"address": {
"@type": "PostalAddress",
"streetAddress": "100 West Snickerpark Dr",
"addressLocality": "Snickertown",
"postalCode": "19019",
"addressRegion": "PA",
"addressCountry": "US"
}
},
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "The Adventures of Kira and Morrison is coming to Snickertown in a can't miss performance.",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/event_offer/12345_201803180430",
"price": "30",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2024-05-21T12:00"
},
"performer": {
"@type": "PerformingGroup",
"name": "Kira and Morrison"
},
"organizer": {
"@type": "Organization",
"name": "Kira and Morrison Music",
"url": "https://kiraandmorrisonmusic.com"
}
},
{
"@context": "https://schema.org",
"@type": "Event",
"name": "The Adventures of Kira and Morrison EVENT THREE",
"startDate": "2025-09-21T19:00-05:00",
"endDate": "2025-09-21T23:00-05:00",
"eventStatus": "https://schema.org/EventCancelled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Snickerpark Stadium",
"address": {
"@type": "PostalAddress",
"streetAddress": "100 West Snickerpark Dr",
"addressLocality": "Snickertown",
"postalCode": "19019",
"addressRegion": "PA",
"addressCountry": "US"
}
},
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "The Adventures of Kira and Morrison is coming to Snickertown in a can't miss performance.",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/event_offer/12345_201803180430",
"price": "30",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"validFrom": "2024-05-21T12:00"
},
"performer": {
"@type": "PerformingGroup",
"name": "Kira and Morrison"
},
"organizer": {
"@type": "Organization",
"name": "Kira and Morrison Music",
"url": "https://kiraandmorrisonmusic.com"
}
}]
</script>
</head>
<body>
</body>
</html>