From World Afropedia
Jump to: navigation, search

hCard is a microformat for publishing the contact details (which might be no more than the name) of people, companies, organizations, and places, in (X)HTML, Atom, RSS, or arbitrary XML. The hCard microformat does this using a 1:1 representation of vCard (RFC 2426) properties and values, identified using HTML classes and rel attributes.

It allows parsing tools (for example other websites, or Firefox's Operator extension) to extract the details, and display them, using some other websites or mapping tools, index or search them, or to load them into an address-book program.

In May 2009, Google announced that they would be parsing the hCard, hReview and hProduct microformats, and using them to populate search-result pages[1].

Example

Consider the HTML:

<source lang="xml">
Joe Doe
Jo
The Example Company
604-555-1234
  <a href="http://example.com/">http://example.com/</a>
</source>

With microformat markup, that becomes:

<source lang="xml">
<head profile="http://www.w3.org/2006/03/hcard">
...
</head>
...
Joe Doe
Jo
The Example Company
604-555-1234
  <a class="url" href="http://example.com/">http://example.com/</a>
</source>

Here the formatted name (fn), organization (org), telephone number (tel) and web address (url) have been identified using specific class names; and the whole thing is wrapped in class="vcard" which indicate that the other classes form an hcard, and are not just coincidentally named. If the hCard is for an organisation or venue, the fn and org classes are used on the same element, as in <span class="fn org">Wikipedia</span> or <span class="fn org">Wembley Stadium</span>. Other, optional, hCard classes also exist.

It is now possible for software, for example browser plug-ins, to extract the information, and transfer it to other applications, such as an address book.

Geo and adr

The Geo microformat is a part of the hCard specification, and is often used to include the coordinates of a location within an hCard.

The adr part of hCard can also be used as a stand-alone microformat.

Live example

Here are the Wikimedia Foundation's contact details, as a live hCard:

Wikimedia Foundation Inc.
200 2nd Ave. South #358
St. Petersburg, FL 33701-4313
USA
Phone: +1-727-231-0101
Fax: +1-727-258-0207

The mark-up (wrapped for clarity) used is:

<source lang="xml">
Wikimedia Foundation Inc.
200 2nd Ave. South #358
      St. Petersburg, 
      FL 33701-4313
USA
Phone: +1-727-231-0101
    Fax: 
    +1-727-258-0207
</source>


(Ordinarily, one would use

<source lang="xml">
FL
</source>

so that the output included region="Florida", but the abbr element is not supported on Wikipedia.)

Note that, in this example, the formal name (fn) and organisation (org) properties are combined on one element, indicating that this is the hCard for an organisation, not a person.

Other attributes

Other commonly used hCard attributes include

  • bday - a person's birth date
  • email
  • honorific-prefix
  • honorific-suffix
  • label - for non-granular addresses
  • logo
  • nickname
  • note - free text
  • photo
  • post-office-box

See also

References

  1. Lua error in ...ribunto/includes/engines/LuaCommon/lualib/mwInit.lua at line 17: bad argument #1 to 'old_pairs' (table expected, got nil).
  • Allsopp, John (2007). Microformats: Empowering Your Markup for Web 2.0. Berkeley: Friendsof. p. 125. ISBN 1590598148. Cite has empty unknown parameter: |coauthors= (help)

External links

cs:HCard es:HCard fr:HCard lv:HCard nl:HCard pl:HCard ru:HCard simple:HCard fi:HCard pt:HCard zh:HCard