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

 ̄綄美尐妖づ 提交于 2019-11-29 15:25:54

Yes, you may use text as value for address. While its expected value is another item (namely PostalAddress) instead of text, Schema.org does not require this (bold emphasis mine):

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.

However, it’s questionable if it’s really the "physical address" of an Organization if you only specify city and state.

If you would use a PostalAddress item as value, you could specify exactly what the address parts are that you provide, so consumers have a better chance to understand your data:

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

(Terminology: You are using the syntax, or format, Microdata and the vocabulary Schema.org.)

I'm afraid that wouldn't really work, as the expected value for the "address" property is the PostalAddress type. But you can simply do something like this as one possible option:

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

I wouldn't recommend that you use the PostalAddress type because technically the postal address should be the full mailing address.

David

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!