h-adr: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(→‎Properties: country-name is full name)
(how to markup country codes)
Line 90: Line 90:
* postal-code
* postal-code
* country-name
* country-name
== FAQ ==
=== What about country codes ===
Q: When marking up an address, can p-country-name be used to markup two letter country codes like "UK"? Or others like 3 letter Olympic country codes?
A: In short no. However if you want to use a country code in your page content, you may mark it up with the <code>abbr</code> element, e.g.
<source lang=html4strict>
<abbr class="p-country-name" title="United Kingdom">UK</abbr>
</source>


== Background ==
== Background ==

Revision as of 21:21, 20 May 2014

<entry-title>h-adr</entry-title> Tantek Çelik (Editor)


h-adr is a simple, open format for publishing structured locations such as addresses, physical and/or postal. h-adr is one of several open microformat draft standards suitable for embedding data in HTML/HTML5 on the web.

h-adr is the microformats-2 update to adr. It is most commonly used as part of an h-card or h-event.

Per CC0, to the extent possible under law, the editors have waived all copyright and related or neighboring rights to this work. In addition, as of 2024-11-22, the editors have made this specification available under the Open Web Foundation Agreement Version 1.0.

Example

Here is a simple postal address example:

<p class="h-adr">
  <span class="p-street-address">17 Austerstræti</span>
  <span class="p-locality">Reykjavík</span>
  <span class="p-country-name">Iceland</span>
  <span class="p-postal-code">107</span>
</p>

Get started

The class h-adr is a root class name that indicates the presence of an h-adr.

p-street-address, p-locality, p-country-name, p-postal-code and all the other h-adr property class names listed below define properties of the h-adr.

See microformats-2-parsing to learn more about property class names.

Properties

h-adr properties, inside an element with class h-adr:

  • p-street-address - house/apartment number, floor, street name
  • p-extended-address - additional street details
  • p-post-office-box - post office mailbox
  • p-locality - city/town/village
  • p-region - state/county/province
  • p-postal-code - postal code, e.g. ZIP in the US
  • p-country-name - full name of country
  • p-label - a mailing label, plain text, perhaps with preformatting
  • p-geo (or u-geo with a RFC 5870 geo: URL), optionally embedded h-geo
  • p-latitude - decimal latitude
  • p-longitude - decimal longitude
  • p-altitude - decimal altitude - new in vCard4 (RFC6350)

All properties are optional.

Status

h-adr is a microformats.org draft specification. Public discussion on h-adr takes place on h-adr-feedback, the #microformats irc channel on irc.freenode.net, and microformats-new mailing list.

h-adr is ready to use and implemented in the wild, but for backwards compatibility you should also mark h-adrs up with classic adr classnames.

Property Details

(stub, add any property explanations here)

Examples in the Wild

  • … add any h-adr examples you find in the wild

Validating

Main article: validators

Test and validate microformats2 markup in general with:

Backward Compatiblity

Publisher Compatibility

For backward compatibility, you may wish to use classic adr classnames in addition to the more future-proof h-adr properties, for example:

<p class="h-adr adr">
  <span class="p-street-address street-address">123 Main St.</span>, 
  <span class="p-locality locality">Pleasantville</span>
  ...
</p>

The class adr is a backward compatible root class name that indicates the presence of an adr.

street-address, locality, and all the other backward compatibility adr property class names are listed below.

Parser Compatibility

Microformats parsers should detect classic properties only if a classic root class name is found and parse them as microformats2 properties.

If an "h-adr" is found, don't look for an "adr" on the same element.

Compatibility root class name: adr

Properties: (parsed as p- plain text unless otherwise specified)

  • post-office-box
  • extended-address
  • street-address
  • locality
  • region
  • postal-code
  • country-name

FAQ

What about country codes

Q: When marking up an address, can p-country-name be used to markup two letter country codes like "UK"? Or others like 3 letter Olympic country codes?

A: In short no. However if you want to use a country code in your page content, you may mark it up with the abbr element, e.g.

<abbr class="p-country-name" title="United Kingdom">UK</abbr>

Background

h-adr is based on the existing adr specification, which was extracted from hCard in order to allow it to be used for applications other than contact information.

See Also