{{short description|Standard for publishing contact details in web pages}} {{Lowercase title}} {{Technical|date=September 2025}} '''hCard''' is a microformat for publishing the contact details (which might be no more than the name) of people, companies, organizations, and places, in HTML, Atom, RSS, or arbitrary XML.<ref>{{cite book|last=Sikos|first=Leslie|title=Web Standards: Mastering HTML5, CSS3, and XML|publisher=Apress|year=2011|url=https://books.google.com/books?id=c4_wQQ1iajgC|access-date=2013-05-10|isbn=978-1430240419}}</ref> 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 and hReview and hProduct microformats, and using them to populate search-result pages.<ref name="Rich-Snippets">{{cite web|url=https://googlewebmastercentral.blogspot.com/2009/05/introducing-rich-snippets.html|title=Introducing Rich Snippets|last1=Goel|first1=Kavi|first2=Ramanathan V.|last2=Guha|first3=Othar|last3=Hansson|date=2009-05-12|work=Google Webmaster Central Blog|access-date=2009-05-25}}</ref> In September 2010 Google announced their intention to surface hCard, hReview information in their local search results.<ref name="Rich-Snippets In Local">{{cite web|url=http://blumenthals.com/blog/2010/09/22/google-announces-full-support-for-microformats-in-local/|title=Google Announces Full Support for Microformats in Local|last=Blumenthal|first=Mike|date=2010-09-22|work=Understanding Google Maps|access-date=2010-09-30}}</ref> In February 2011, Facebook began using hCard to mark up event venues.<ref name="Protalinski">{{cite web|url=http://www.zdnet.com/blog/facebook/facebook-adds-hcalendar-and-hcard-microformats-to-events/266|archive-url=https://web.archive.org/web/20110219130150/http://www.zdnet.com/blog/facebook/facebook-adds-hcalendar-and-hcard-microformats-to-events/266|url-status=dead|archive-date=February 19, 2011|title=Facebook adds hCalendar and hCard microformats to Events|last=Protalinski|first=Emil|date=2011-02-18|publisher=ZDNet|access-date=24 March 2011}}</ref>
==Example== Consider the HTML: <syntaxhighlight lang="xml"> <ul> <li>Joseph Doe</li> <li>Joe</li> <li>The Example Company</li> <li>604-555-1234</li> <li><a href="http://example.com/">http://example.com/</a></li> </ul> </syntaxhighlight>
With microformat markup, that becomes:
<syntaxhighlight lang="xml"> <ul class="vcard"> <li class="fn">Joseph Doe</li> <li class="nickname">Joe</li> <li class="org">The Example Company</li> <li class="tel">604-555-1234</li> <li><a class="url" href="http://example.com/">http://example.com/</a></li> </ul> </syntaxhighlight>
A profile may optionally be included in the page header:
<syntaxhighlight lang="xml"> <link rel="profile" href="http://microformats.org/profile/hcard"> </syntaxhighlight>
Here the properties ''fn'',<ref>no friendly name defined in the specification http://microformats.org/wiki/hcard#Property_List, but one might think of it as "full name", "formal name", "formatted name", or "family name"</ref> ''nickname'', ''org'' (organization), ''tel'' (telephone number) and ''url'' (web address) have been identified using specific class names; and the whole thing is wrapped in <code>class="vcard"</code> which indicates that the other classes form an hcard, and are not just coincidentally named. If the hCard is for an organization or venue, the ''fn'' and ''org'' classes are used on the same element, as in <code><nowiki><span class="fn org">Wikipedia</span></nowiki></code> or <code><nowiki><span class="fn org">Wembley Stadium</span></nowiki></code>. 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 of|2023|February|lc=y}}, as a live hCard: <blockquote style="font-weight:bold"> <div class="vcard"> <div class="fn org">Wikimedia Foundation, Inc.</div> <div class="adr"> <div class="street-address">1 Montgomery Street, Suite 1600</div> <div> <span class="locality">San Francisco</span>, <abbr class="region" title="California">CA</abbr> <span class="postal-code">94104</span></div> <div class="country-name">USA</div> </div> <div>Phone: <span class="tel">+1-415-839-6885</span></div> <div>Email: <span class="email">info@wikimedia.org</span></div> <div class="tel"><span class="type">Fax</span>: <span class="value">+1-415-882-0495</span></div> </div> </blockquote>
The mark-up (wrapped for clarity) used is: <syntaxhighlight lang="xml"> <div class="vcard"> <div class="fn org">Wikimedia Foundation Inc.</div> <div class="adr"> <div class="street-address">1 Montgomery Street, Suite 1600</div> <div> <span class="locality">San Francisco</span>, <abbr class="region" title="California">CA</abbr> <span class="postal-code">94104</span></div> <div class="country-name">USA</div> </div> <div>Phone: <span class="tel">+1-415-839-6885</span></div> <div>Email: <span class="email">info@wikimedia.org</span></div> <div class="tel"> <span class="type">Fax</span>: <span class="value">+1-415-882-0495</span> </div> </div> </syntaxhighlight>
In this example, the ''fn'' and ''org'' properties are combined on one element, indicating that this is the hCard for an organization, not a person.
==Other attributes== Other commonly used hCard attributes include *<code>bday</code>{{dash}}a person's birth date *<code>email</code> *<code>honorific-prefix</code> *<code>honorific-suffix </code> *<code>label</code>{{dash}}for non-granular addresses *<code>logo</code> *<code>nickname</code> *<code>note</code>{{dash}}free text *<code>photo</code> *<code>post-office-box</code>
==See also== * vCard * XHTML Friends Network * FOAF
==References== {{reflist}}
==Further reading== * {{cite book |title=Microformats: Empowering Your Markup for Web 2.0 |last=Allsopp |first=John |year=2007 |publisher=Friendsof |location=Berkeley |isbn=978-1-59059-814-6 |page=[https://archive.org/details/isbn_9781590598146/page/125 125] |url-access=registration |url=https://archive.org/details/isbn_9781590598146/page/125 }} * [https://microformats.org/wiki/hcard hCard 1.0] on microformats.org
{{Semantic Web}}
{{DEFAULTSORT:Hcard}} Category:Microformats Category:Business cards