无法使用 PostalAddress 和没有 Place 来验证 Event rich snippet
Can't validate Event rich snippet with PostalAddress and no Place
我正在为 "open house" 住宅之旅定义 http://schema.org/Event。该活动的名称是 "Open House,",但该地点没有 "name"(地址除外)。
根据 https://developers.google.com/structured-data/rich-snippets/events,我应该能够使用 PostalAddress 作为代码段的位置字段,也许像这样:
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span>
</div>
</div>
</div>
但这在丰富网页摘要测试工具中失败了。 https://developers.google.com/structured-data/testing-tool/ 它说我的位置需要 "name" 和 "address" 属性。
如果该位置是一个命名地点,那么这就很有意义了,例如餐馆或商业场所。例如,这在测试工具中验证:
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<div itemprop="name">WHAT DO I PUT HERE?!</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span></div>
</div>
</div>
</div>
问题是,我不知道住宅用什么名字。它没有名字,只有地址。
构建此代码段的正确方法是什么? Google 的文档不正确吗?如果测试工具正确,我是否必须命名一个无名的地方?
刚发完问题,我就意识到我可以把地址嵌套在名字里,让名字和地址相等。测试工具接受这一点。 (但这感觉不对。)
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<div itemprop="name">
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span></div>
</div>
</div>
</div>
</div>
我正在为 "open house" 住宅之旅定义 http://schema.org/Event。该活动的名称是 "Open House,",但该地点没有 "name"(地址除外)。
根据 https://developers.google.com/structured-data/rich-snippets/events,我应该能够使用 PostalAddress 作为代码段的位置字段,也许像这样:
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span>
</div>
</div>
</div>
但这在丰富网页摘要测试工具中失败了。 https://developers.google.com/structured-data/testing-tool/ 它说我的位置需要 "name" 和 "address" 属性。
如果该位置是一个命名地点,那么这就很有意义了,例如餐馆或商业场所。例如,这在测试工具中验证:
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<div itemprop="name">WHAT DO I PUT HERE?!</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span></div>
</div>
</div>
</div>
问题是,我不知道住宅用什么名字。它没有名字,只有地址。
构建此代码段的正确方法是什么? Google 的文档不正确吗?如果测试工具正确,我是否必须命名一个无名的地方?
刚发完问题,我就意识到我可以把地址嵌套在名字里,让名字和地址相等。测试工具接受这一点。 (但这感觉不对。)
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<div itemprop="name">
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span></div>
</div>
</div>
</div>
</div>