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

人走茶凉 提交于 2019-12-18 09:03:12

问题


I have a CMS that has a single text field for an Organization address. The data is stored very inconsistently and, in many cases, I'm dealing with city/state only. I'm fairly new to schema.org and would like to know if I can simply do something like the following to handle the markup:

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

As I said, I'm new to all this, but I guess I'm using the "Microdata" format.


回答1:


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.)




回答2:


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



来源:https://stackoverflow.com/questions/28566018/can-you-use-plain-text-for-addresses-in-schema-org-markup

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