schema.org 标记中的地址可以使用纯文本吗?

Can you use plain text for addresses in schema.org markup?

我有一个 CMS,它有一个用于 Organization 地址的文本字段。数据存储非常不一致,在许多情况下,我只处理 city/state。我是 schema.org 的新手,想知道我是否可以简单地执行以下操作来处理标记:

<p itemprop="address">Some city, WY</p>

正如我所说,我是新手,但我想我使用的是 "Microdata" 格式。

恐怕这不会真正起作用,因为 "address" 属性 的预期值是 PostalAddress 类型。但是你可以简单地做这样的事情作为一种可能的选择:

<span itemprop="location" itemscope itemtype="http://schema.org/City">
<span itemprop="name">City Name</span>, State
</span>

我不建议您使用 PostalAddress 类型,因为从技术上讲,邮政地址应该是完整的邮寄地址。

大卫

是的,您可以使用文本作为 address. While its expected value is another item (namely PostalAddress) instead of text, Schema.org does not require this 的值(粗体强调我的):

While we would like all the markup we get to follow the schema, in practice, we expect a lot of data that does not. We expect schema.org properties to be used with new types. We also expect that often, where we expect a property value of type Person, Place, Organization or some other subClassOf Thing, we will get a text string. In the spirit of "some data is better than none", we will accept this markup and do the best we can.

然而,如果你只指定城市和州,它是否真的是 Organization 的 "physical address" 值得怀疑。

如果您要使用 PostalAddress 项作为值,您可以准确指定您提供的地址部分,以便消费者有更好的机会了解您的数据:

<p itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
  <span itemprop="addressLocality">Some city</span>, 
  <span itemprop="addressRegion">WY</span>
</p>

(术语:您正在使用 语法 或格式、微数据和 词汇 Schema.org。)