hCard FAQ

Jump to: navigation, search


This documents frequently asked questions and answers (FAQs) about hCard. For FAQs regarding microformats in general, or across microformats, see the microformats FAQ.

If you have a new question to ask, please consider first asking your question on the microformats irc channel (preferably) or the microformats-discuss mailing list. New questions and answers should be added to the end of the list. If you have a new question but not an answer, please add it to hCard issues.

Contents

Editing this Page

Please do not use "?" or other punctuation in the headers - it helps to keep the URLs to their fragment identifiers shorter and easier to read, copy/paste etc. See how-to-play for more wiki editing guidelines.

Q&A

What is the point of hCard

What is the point of hCard to people, businesses, etc.?

How is hCard different than just links

How is hCard different than just links?

How does hCard help users

How does hCard help users, e.g. how does it improve the user experience in browsers more than just providing name and email as text?

How can I style hCards with CSS

How can I style hCard with CSS?

How do I convert hCards to vCards for download on a site

Is there any live way to convert hCards to vCards for download on a site? In other words, I have added hCard to my page, but i'd like my users to have a 'download vCard' button.

<a href="http://h2vx.com/vcf/YOURURLHERE">download vCard</a>

Consider using more user-friendly text as well, like Add to Address Book. There are many examples of this in the hCard Examples in the Wild page. Note that the H2VX hCard to vCard service is based on the open source XSLT "X2V" by Brian Suda and others. If you want, you can install X2V yourself and run your own local converter.

Should I use ADDRESS for hCards

Should I use the more semantic <address> element for my hCards?

For more on different types of significant hCards for pages, and semantics distinctions among them, see hcards-and-pages.

Why is adr property necessary

What is the point of class="adr" when we have the <address> element?.- 2006-12-04 asked by Joshie Surber.

Why is url property necessary

Why is it necessary to put class name "url" on URL elements in the hCard when those hyperlinks already start with "http://", and that is enough to distinguish them from email links?

Can an hCard have multiple URLs

Can an hCard have multiple URLs?

I have a problem with serving a vCard vcf file

I have a problem with serving a vCard .vcf file that has the info from my /contact/ page from my website. E.g. browsers just display the text of the vCard .vcf file instead of downloading it.

The easiest thing to do and support (especially with more and more vCard consumers out there with their own quirks) is to:

  1. Add hCard markup to your /contact/ page where you already have your contact info visible in the content. See also the hCard creator which is a useful tool for learning how hCard markup works.
  2. Change the link to your vCard .vcf file to point to: http://h2vx.com/vcf/http://yourwebsite.example.com/contact/

This way you won't have to worry about duplicate data either - just update the content on your contact page marked up in hCard and anyone that gets your vCard will automatically get your updated info without you having to worry about updating separate file.

How do I support an existing vCard URL

I already have a vCard that I keep up-to-date. I don't want to change any references to it because it might break something else, what can I do?

RewriteRule ^path/to/old.vcf http://h2vx.com/vcf/http://example.com/hCard_encoded.htm&filename=old.vcf

Now you shouldn't have to do anything else, all links to the "old.vcf" are redirected to the webservice and will return a new vCard that is dynamially generated from your page.

I think that using 'Redirect' is better than using mod_rewrite (is not enabled on some hosts) --Robert Bachmann

Redirect /path/to/old.vcf http://h2vx.com/vcf/http://example.com/hCard_encoded.htm&filename=old.vcf

Why does my hCard photo not show up in Address Book

Why are photos not working for me when I import my hCard as a vCard into the Apple Address Book?

Why does hCard use vcard as the root class name

hCard maps the properties and values of the vCard standard (RFC2426), hence the use of the vcard class name inside the HTML markup. More background on the reasons behind that decision here: hCard Parsing: Root Class Name.

What are plural hCard properties

Is there a list of all hCard properties which can be plural?
Is there a list of all the properties which can have multiple instances?

How do you mark up an organization

How do I create an hCard for an organization or a company?

Mark up hCards for organizations or companies by using both the "fn" and "org" properties for the name of the organization/company. E.g.

<p class="vcard">You can help support
 <span class="fn org">microformats.org</span>
 by publishing microformats on your web pages, 
 adding microformats support to your tools, 
 giving constructive feedback on the wiki, 
 and participating in discussions on IRC channel
</p>

See also: hCard authoring: Organization hCards.

What does FN stand for

What does FN stand for?

Type purpose: To specify the formatted text corresponding to the name of the object the vCard represents.

How do you mark up a first or last name

I don't see anything for first/last names.

See hCard authoring: Importance of Names for examples.

How do you mark up a middle name or initial

How does one handle middle initials/names in hCard?

How do you mark up suffixes

How does one handle suffixes, both family related and honorific?

<abbr class="honorific-suffix" title="Junior">Jr.</abbr>

How do you mark up city state and zip

How do you mark up the city, state, and zip code of an address?

How is gender represented

How do you represent gender in hCard?

If you're using microformats2:

If you're using hCard:

It is possible to represent gender implicitly in the honorific-prefix field, e.g. Mr. for male, and Ms. for female:

<span class="honorific-prefix">Mr.</span>

or

<span class="honorific-prefix">Ms.</span>

This approach does have the limitation that "Mr." and "Ms." (or "Miss"/ "Mrs.") may conflict with a higher-ranking, gender-neutral honorific, such as "Dr." or "Rev." for the person, as it is unusual to refer to someone as "Mr. Dr." or "Mrs. Rev." for example. See hcard-issues.

See also the gender research page.

Can a hCard contain extra elements

Is it OK for an hCard node to contain extra elements?

Can a GEO be inferred from an ADR in an hCard

Can I automatically add GEO from an address when transforming an hCard to vCard if it is not present?

X2V does not convert email with name as plain text

X2V doesn't convert my email address correctly, it is in the form href="FirstName LastName <Email@example.com>"

One possible valid hCard markup would be:

<span class="vcard">
  <span class="fn">Firstname Lastname</span>
 &amp;lt;<a class="email" href="mailto:Email@example.com">Email@example.com</a>&amp;gt;
</span>

This might be displayed as:

Firstname Lastname <email@example.com>

What hCard properties are required

What properties are required in an hCard?

Does N property require all sub-properties

If I use the 'n' property, do I have to use ALL of the sub-properties?

Do FN and N need to be on same element

Do the 'fn' and 'n' properties have to be on the same element?

<p class="vcard">My name is
<span class="n">
<span class="honorific-prefix">Mr.</span>
<span class="given-name">John</span>
<span class="additional-name">Q</span>
<span class="family-name">Public</span>
</span>
but you can just call me
<span class="fn">Johnny</span>
</p>

Can FN be in a backwards order and N still extract the information correctly

Can FN be in a backwards order and N still extract the information correctly?

<span class="fn n"><span class="family-name">Smith</span>,  <span
class="given-name">John</span></span>

The FN value would be "Smith, John", but the N value would correctly extract "John" as the given name, and "Smith" as the family name. This is useful for some cultures which reverse the name order.

The same applies to the sub-properties of addresses. You can order post-code before locality, or vice versa depending on cultural norms.

How do you convert a vCard to an hCard

Is there a way to convert a vCard to an hCard?

Are descendant elements recognized in a microformat

Are descendants recognized in a microformat property?

<span class="country-name">United States <small>of</small> America</span>

The output would be "United States of America".

Do properties like TEL use all descendants

Do properties like TEL use all descendants? e.g.

<span class="tel">
 <span class="type">Home</span>:<span class="value">+1.234.567.8900</span>
</span>

Shouldn't that output be "TEL:Home: +1.234.567.8900"?

Can you have multiple value elements

Can you have multiple class="value" elements inside a property and what happens to them?

<span class="tel"><span class="type">Home</span>:<span class="value">+1</span>.<span class="value">234</span>.<span class="value">567</span>.<span class="value">8900</span></span>

would output: "+12345678900".

Can you mix properties and the root class name

Can you put properties on the same element as the root class for a microformat? E.g. span class="vcard fn"?

In this case in the question, you need two elements:

The only time you can put a root class name (like "vcard") and a property class name on the same element, is when the root class name is basically providing an entire object as the value of the property which then belongs to some other object higher up the tree.

E.g. the location of an hCalendar event also being an hCard:

<span class="vevent">
  <span class="summary">HTML5 Developer Conference</span>, 
  <time class="dtstart">2013-04-01</time>...<time class="dtend">2013-04-03</time>, at
  <span class="location vcard">
    <span class="fn org">The Palace Hotel</span>, 
    <span class="adr"><span class="locality">San Francisco</span></span>
  </span>
</span>


Note the <span class="location vcard"> which specifies that the location of the outer hCalendar event is an entire hCard nested inside.

Can you mix a property and its sub-properties

Can singular sub-properties be mixed with parents?

Can you use query strings on email

What happened to the Query String on my email address?

What types of email can you specify

What types of email can you specify? RFC2426 Section 3.3.2 says "A non-standard value can also be specified." Does this refer to a non-standard e-mail address value or type value?

Are ADR and TEL types case sensitive

Is the list of possible types for an ADR and TEL case sensitive?

How does GEO work with ABBR

What happens to the GEO sub-properties when GEO is used with ABBR?

<span class="geo">
<span class="latitude">123.45</span>
<span class="longitude">67.89</span>
</span>
 
<abbr class="geo" title="123.45;67.89">My House</abbr>

When used with an <abbr> element the latitude and longitude are separated by a semicolon.

How do you mark up a phone extension

How do I mark up a phone extension in hCard? There doesn't seem to be a way to declare a telephone extension in the vCard RFC 2426 spec, the suggested way is currently:

<span class="tel">
    <span class="type">work</span>: <span class="value">800 555-1212 x 1234</span>
</span>

RFC 3966 suggests that an extension be indicated with ";ext=" for example:

<span class="tel">
    <span class="type">work</span>: <span class="value">800 555-1212;ext=1234</span>
</span>

although that is more relevant when used as a URI:

<span class="tel">
    <span class="type">work</span>: <a class="value" href="tel:+18005551212;ext=1234">800 555-1212;ext=1234</a>
</span>

ITU-T Recommendation E.123 1.6 specifies the use of the word "extension" or abbreviation thereof:

   Telephone International +22 607 123 4567 ext. 876

The above example may be better as:

<span class="tel">
    <span class="type">work</span>: <a class="value" href="tel:+18005551212;ext=1234">800 555-1212 ext. 1234</a>
</span>

How do you encode IM accounts

How do I encode my IM account in hCard?

Can you hCard the deceased

How do you make an hCard for the deceased?

Any plans for xparams

Are there plans to include x-parameters in future versions of hCard?

What is a word in implied optimizations

What constitutes a "word" for the purpose of 'implied-n optimization'?

How do you create non English title attributes

My website is not in English and I want the title attributes (sown as "tooltips", in many browsers) to be in my native language

<abbr class="type" title="home">
 <span title="[your native word for home here]">
  to my home
 </span>
</abbr>

Having an span with a title attribute inside the abbr element will only display the title on the span, where you have the text (your native word for home here).

How do you add categories to an hCard

How do you add categories to an hCard?

<a class="category" rel="tag" 
   href="http://en.wikipedia.org/wiki/microformats">microformats</a>

How are category and rel-tag related

What is the relationship between the CATEGORY property and rel-tag?

<span class="category">food</span>
<a class="category" rel="tag" href="http://example.com/food">Food</a>

Why not put type for tel or adr into class

Why not put the 'type' value for the 'tel' or 'adr' properties into the class name? E.g. <span class="fax">(415) 555-1212</span>

How do I markup multiple addresses

How do I markup separate addresses, like for home and work?

<div class="adr">
 <span class="type">home</span> address:
 <div class="street-address">123 Main Street</div>
 <span class="locality">Any Town</span>, <span class="region">CA</span>, 
 <span class="postal-code">91921-1234</span>
</div>
<div class="adr">
 <span class="type">work</span> address:
 <div class="street-address">789 Main Street</div>
 <span class="locality">Any Town</span>, <span class="region">CA</span>, 
 <span class="postal-code">91921-1234</span>
</div>

As a result, note that each element with class name "adr" is treated as a separate address with its own subproperties and values.

Why is IMG alt not being picked up

I have my name in an <img> alt attribute and it is not being picked up by hCard tools. Why not?

You can use an <img> alt value to specify any text (i.e. not URL) property value by placing the class name directly on the <img> element itself. Other element alternatives are documented in hCard: Human vs. Machine readable.

Here is an example of doing it WRONG and the corrected RIGHT way. White space added for readability:

WRONG

<span class="vcard">
 <a class="url fn photo" href="http://tantek.com">
  <img src="http://tantek.com/icon80.jpg" alt="Tantek Çelik" />
 </a>
</span>

RIGHT

Note the moving of the class names "fn" and "photo" from the <a> to the <img>

<span class="vcard">
 <a class="url" href="http://tantek.com">
  <img class="fn photo" src="http://tantek.com/icon80.jpg" alt="Tantek Çelik" />
 </a>
</span>

Some have suggested having the IMG alt (and other such textual alternatives) always be part of surrounding property values, and while this may initially seem appealing, this was deliberately rejected at the creation of hCard to give publishers more control.

In addition all too often there is "garbage" (or just extra unwanted text) in alt attributes for a variety of publisher reasons, and that extraneous text would pollute otherwise clean property values in numerous existing sites.

Thus only if the publisher explicitly wants the text from the alt attribute do they add the respective class value to get it.

Finally, it is simpler and more predictable for publishers if they know that for images and other such URL related elements (a, object, etc.) that whether they are specifying a URL property (like "email", "photo", "url", etc.) or a text property (like "fn", "nickname", etc.) in either case directly specifying the property on the element is the way to do it.

How do I mark up each ADR with a GEO

I have an hCard with multiple addresses. How do I mark-up each ADR with a GEO?

How do I markup an unstructured location

If I have a location field which is unstructured, how do I mark that up? I might have a user typing "San Francisco" or "San Francisco, CA" or "USA", etc.

<span class="label">San Francisco, CA</span>

Partial Dates or A Gentleman Never Asks

The date design pattern recommends using ISO 8601 dates, compatible with W3CDTF or RFC 3339 (which are both subsets of ISO 8601). Fortunately W3CDTF allows for partial dates. For example:

Such dates are supported by most microformat parsers. ISO 8601 also allows for dates to be provided without the year (and even without the month):

These dates are not compatible with W3CDTF or RFC 3339, and have less broad-ranging support in microformat parsers. It should also be noted that the vCard specification requires dates to include years, so even if your microformat parser supports one of these formats, it would probably have to fill in a dummy year when providing a vCard output.

What is AGENT

What is the "agent" property for in hCard?

From Ben Ward on IRC

In business context, the main vcard could be, for example ‘Dana B. Lawyer’, and her vcard contains an AGENT for ‘Joe Secretary’. It is someone who acts as an ‘agent’ of the main person.

Can hCards use variants of properties like Given-Name or country

Can hCards use variants of properties like "Given-Name" or "country"?

No. Only the precise lowercase property names in the hCard spec are valid (see related: case-sensitive).

The following variations that folks have asked about are all invalid and MUST be ignored in hCards:

Each of these could perhaps form the basis of a simple hCard parsing error test. See also:


Related Pages

The hCard specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. These thoughts, issues, and questions are kept in separate pages.

hCard FAQ was last modified: Monday, April 1st, 2013

Views