schema.org - 微数据:为什么 Google 要求在场地举办活动?
问题描述
我有以下微数据 HTML 代码:
<div itemscope itemtype="http://schema.org/PerformingArtsTheater">
<h2 itemprop="name">The Old Vic</h2>
<div itemscope itemtype="http://schema.org/TheaterEvent" itemprop="http://schema.org/event">
<h3 itemprop="name">Endgame</h3>
<div itemprop="startDate">2020-01-27</div>
</div>
</div>
即:一个PerformingArtsTheater
叫做“The Old Vic”的事件有一个事件,TheaterEvent
叫做“Endgame”。
当一个事件发生在 aPerformingArtsTheater
时Place
,我会认为很明显,它TheaterEvent
的位置是同一个“PerformingArtsTheater”?
但是谷歌的结构化数据测试工具发现了一个错误TheaterEvent
:“A value for the location field is required.”。
怎么来的?这里的一个location
字段充其量不是多余的,最坏的情况是矛盾吗?
(比如“老维克的二月:塞缪尔贝克特在老维克的残局。”)
有没有办法在不引入冗余的情况下取悦 Gogle?
解决方案
Thing > Event > TheaterEvent
TheaterEvent(剧院表演。) -location
属性预期类型 place
或更具体的对象,如PerformingArtsTheater:
Thing > Place > CivicStructure > PerformingArtsTheater
在您的情况下,PerformingArtsTheater 是The Old Vic
- 正确的数据结构大纲:
位置(事件片段的必需属性)
https://developers.google.com/search/docs/data-types/event
<div itemprop="location" itemscope="" itemtype="http://schema.org/PerformingArtsTheater">
<span itemprop="name">Theater name</span>
<meta itemprop="address" content="London, UK"/>
</div>
将位置作为 PerformingArtsTheater 属性(嵌套对象)
<section itemscope="" itemtype="http://schema.org/TheaterEvent">
<h2 itemprop="name">Event Name</h2>
<div itemprop="startDate">2020-01-27</div>
<address itemprop="location" itemscope="" itemtype="http://schema.org/PerformingArtsTheater">
<p itemprop="name" content="Theater name">Theater name</p>
<meta itemprop="address" content="Bennelong Point, Sydney NSW 2000, Australia"/>
</address>
</section>
结果 ==> 没有错误:
顺便说一句,这是嵌套 schema.org 对象的一个很好的例子。
推荐阅读
- python - 试图在 div 中抓取 div 中的元素,但无法弄清楚
- java - PDFBox NoClassDefFoundError PDDocument
- javascript - 在 React.js 中设置状态时在哪里放置条件语句?
- python - Typeerror:CNN 中不可散列的类型列表
- javascript - 无法理解使用 Promise Express 加载 json
- node.js - 如何使用 nodejs 设置 Authorization Bearer 标头
- javascript - 我创建了标签,但它没有显示在网页上
- autotools - 如何在 autotools 项目中添加/使用 --with-package arg?
- java - 如何在 Java 中设计抽象数据类型(ADT)?
- java - 我们可以将重写的方法作为Java中的抽象方法吗?