hcard-brainstorming

From Microformats Wiki
Revision as of 20:16, 28 January 2008 by AndyMabbett (talk | contribs) (adr-poll (orphan))
Jump to navigation Jump to search

hCard Brainstorming

This page is for brainstorming about various uses and details of hCard. This page contains proposals. For the current state please see hCard.

Authors

Contributors

Problems Being Solved

Some of the problems that hCard helps to solve:

Named locations

Most hCards contain contact information for people or organizations. But locations that aren't organizations are also deserving of their own hCard (e.g. somebody's house/apartment). This situation can be represented by combining "fn" and "extended-address".

"fn" and "extended-address" combination

Proposal: Similar to organization contact info, if the "fn" property and an "extended-address" property have the exact same value (typically because they are set on the same element, e.g. class="fn extended-address"), then

  1. The hCard represents contact information for a place and SHOULD be treated as such.
  2. The author also MUST NOT set the "N" property, or set it (and any sub-properties) explicitly to the empty string "".
  3. Parsers SHOULD handle the missing "n" property by implying empty values for all the "n" sub-properties.

Further proposal: Consider also an hCard for a City, "Birmingham, England": Birmingham may be the "fn" and the "locality", but it's not an "extended-address". Perhaps the rule should be that the hCard is for a place if the "fn" is on any address component (e.g "fn locality" or "fn street-address")?

Examples in the wild

  • The named location "Picnic benches" in the address "Picnic benches, South Park, San Francisco, California" in a blog post on adactio.com.
<span class="vcard">
 <span class="adr">
  <span class="fn extended-address">Picnic benches</span>
  <span class="street-address">South Park</span>
  <span class="locality">San Francisco</span>
  <span class="region">California</span>
 </span>
</span>

Potential examples in the wild

  • The location "Phone Boxes by the Sealife Centre" on Upcoming is currently marked up as "fn org":
<div class="vcard">
 <div class="fn org">Phone Boxes by the Sealife Centre</div>
  <div class="adr">
   <span class="street-address">Marine Parade</span><br />
   <span class="locality">Brighton & Hove</span>,
   <span class="region">England</span>
   <span class="postal-code">BN2 1TB</span><br />
   <span class="country">United Kingdom</span><br />
   <span class="tel">01273 606674</span>
  </div>
 <div class="note">Just a meeting place, in case the venue changes.</div>
</div>

This could be marked up as:

<div class="vcard">
 <div class="adr">
  <div class="fn extended-address">Phone Boxes by the Sealife Centre</div>
   <span class="street-address">Marine Parade</span><br />
   <span class="locality">Brighton & Hove</span>,
   <span class="region">England</span>
   <span class="postal-code">BN2 1TB</span><br />
   <span class="country">United Kingdom</span><br />
   <span class="tel">01273 606674</span>
  </div>
 <div class="note">Just a meeting place, in case the venue changes.</div>
</div>

Concerns

The above seems to be an elegant solution, but a wider variety of examples form published pages are needed, to be sure it meets all common scenarios. these should include cases where "adr" is not already used; note that in that case an extra level of nesting is required. The implications of this, for hCards already published, should be considered.

Also, what about hCards for published locations, which already include an extended address?

e.g.

<div class="vcard">
  <span class="fn org">Powell's Pool</span>
  <span class="adr">
    <span class="extended-address">Sutton Park</span>
    <span class="locality">Birmingham</span>
    <span class="country-name">England</span>
  </span>
</div>

Andy Mabbett 05:40, 15 Dec 2007 (PST)

named location formats

Previous named location format efforts:

Simple GeoRSS featurename

The Simple GeoRSS vocabulary contains the following named location example in the "Additional Properties" section that references a featurename tag.

Feature Type, Feature Name, and Relationship Tags

The Feature Type, Feature Name, and Relationship tags are specified as GeoRSS elements.

    <georss:point>45.256 -110.45</georss:point>
    <georss:featuretypetag>city</georss:featuretypetag>

    <georss:relationshiptag>is-centered-at</georss:relationshiptag>

    <georss:featurename>Podunk</georss:featurename>

A search for featurename on georss.org fails to find any other references however, including a definition.

An email on the georss list from Dec 2006 thread "featurename, other missing bits from the site" notes that "there is some updating to do" in response to a concern that "that descriptions of "featurename" are not present on GeoRSS Simple and the GeoRSS Model. GeoRSS GML makes no mention of the non-geometric properties at all."

FN Nickname semantic

There are many sites (e.g. Flickr, Consumating) which permit the user to both have a multi-word login/handle/alias, and not show their real name (fn, n, given-name, family-name etc.).

For the people represented by the profile pages of these sites, the best we can do is mark-up their login/handle/alias as their "nickname". Originally, we had thought that such handles etc. were single words only, and thus we created the Implied nickname optimization accordingly, where you can markup the handle as an "fn", and have it automatically set a "nickname" property value, and empty values for all the "n" sub-values.

In order to deal with multi-word handles, similar to the hCard Organization contact info method, the following is proposed:

"fn" and "nickname" combination

Due to the use of potentially multi-word nicknames/handles/usernames in content published on the Web, (e.g. on sites like Flickr and Consumating), hCard has a mechanism for specifying a multi-word "fn" that is also a "nickname" without affecting any "n" sub-properties that are otherwise specified, and explicitly implying empty defaults for "n" sub-properties.

Similar to the implied "nickname" optimization, if the "fn" property and a "nickname" property have the exact same value (typically because they are set on the same element, e.g. class="fn nickname"), then

  1. The content of the "fn" is treated as a "nickname" property value.
  2. Parsers should handle the missing "n" property by implying empty values for all the "n" sub-properties.

Implied FN from N

Since the "n" property is more detailed and structured than the "fn" property, and hcard-examples-in-wild have shown that very often what is specified for "n" sub-properties is also specified for the "fn" property, we could add the following implied "fn" optimization which would permit sites to only use "n" and its subproperties.

In addition, some sites don't have contiguous uninterrupted text that represents the desired "fn" value, and would much rather have the "fn" implied from "n" subproperties. E.g. "Citizen Space Citizens" on hcard-examples-in-wild.

implied "fn" from "n" optimization

If an hCard has no "fn", yet has an "n" property with one or more subproperties, then the "fn" property value can be implied by concatenating the "n" subproperty values as follows, with a space between each subproperty value, and multiple subproperty instances.

  • 'honorific-prefix'es (as found in document order)
  • 'given-name'
  • 'additional-name's (as found in document order)
  • 'family-name'
  • 'honorific-suffix'es (as found in document order)

Implied N from its subproperties

Since the "n" subproperties are sufficiently uniquely named (that is, they are not used by any other hCard property), and "n" is one of the hcard-singular-properties, it is possible to consider leaving out the "n" property itself fo the hCard, and simply directlly using the subproperties, as properties of the hCard.

implied "n" from its subproperties

If an hCard has no "fn" nor "n" properties, then the entire scope of the hCard is considered to be inside an implied "n" property.

E.g. this markup:

<span class="vcard">
 <span class="given-name">Tantek</span>
 <span class="family-name">Çelik</span>
</span>

would be treated from a parsing perspective as:

<span class="vcard"><span class="n">
 <span class="given-name">Tantek</span>
 <span class="family-name">Çelik</span>
</span></span>

Which, with the implied "fn" from "n" optimization, would then be effectively treated as:

<span class="vcard"><span class="fn n">
 <span class="given-name">Tantek</span>
 <span class="family-name">Çelik</span>
</span></span>

Examples

  • See hcard-examples, which provides several illustrative instructive examples, as well as 1:1 hCard examples for each example in RFC 2426.

Using RFC2806 with hCard

RFC 2806 defines the telephone scheme "tel:", "fax:" and "modem:" to handle phone communications with URIs in the same way, "mailto:" is defined for email. It's part of the list or registered schemes by IANA : Uniform Resource Identifier (URI) SCHEMES

tel   telephone [RFC2806]
fax   fax       [RFC2806]
modem modem     [RFC2806]

It is practical to write your tel number like this.

<a class="tel"      href="tel:+1-919-555-7878">+1-919-555-7878</a>

or even

<a class="tel"      href="tel:+1-919-555-7878">Mr Smith's phone</a>

You can add support for "tel:" to your desktop and to your browser

On the CSS front… You could for example add automagically an icon. I have put the property !important for those who wants to add it to their own stylesheet in their browsers, so they know type of links when browsing.

a[href^="tel:"]:before {
    content: '\260f  ' !important;
    padding-left: 20px !important; }

a[href^="mailto:"]:before {
    content: '\2709  ' !important;
    padding-left: 20px !important; }


Encoding "modern" attributes

Since vCard was first established, various interactive communication technologies and addressing schemes have been widely adopted. Although there aren't specific properties for these technologies / addressing schemes, they can be captured as URLs or email addresses.

This has now been written up for the most part. See:

http://microformats.org/wiki/hcard-examples#New_Types_of_Contact_Info

Still to be addressed:

  • iChat mac.com addresses, simply store "@mac.com" email addresses, e.g.
    • <a class="email" href="mailto:steve@mac.com">...
  • MSN Instant Messenger, you can simple store "@hotmail.com" or "@msn.com" or "@passport.com" email addresses.
  • Internet Relay Chat (IRC), use "irc:" URLs.

Auto-Discovery

See hcard-brainstorming-autodiscovery

geo improvements

See geo-brainstorming

Other use cases

Please add your suggestions!

hCard microformats could be used to:

  • Calculate and display the subject's age "as of today".
  • Calculate and display the subject's age at death (if a Date of Death is available)
  • Generate a recurring iCal for a living subject's birthday
  • Generate a recurring iCal for a dead subject's "anniversary of birth" (if a Date of Death is available)
  • ...

Issues with vCard Applications

See vcard-implementations.

Open Questions

Q: since many of the components would be using CSS classes for encoding data, it is possible to MIX two different profiles. (e.g. hCard and XFN) There are no real constraints on where/how to enforce class names, these are based on the html profile, since it is difficult to associate the text within the attribute to a specific profile.

...
<a href="mailto:joe.smith@example.com" class="fn" rel="met">Joe Smith</a>
...

-- Brian Suda

Q: Preserving White space? Should the transforming applications preserve extra white space characters? For example:

<a href="http://mywebsite.com/" class="fn n">
    <span class="given-name">John</span>
    <span class="other-names">Q.</span>
    <span class="family-name">Public</span>
</a>

When transformed into a vCard, the N property will pick apart the span tags and create the value for N correctly seperated by colons. The FN property will take a string and simply display it. There are two possible renderings for FN:

John Q. Public

    John
    Q.
    Public

Either the white-space is preserved or it is not. Which should the transforming applications render?

-- Brian Suda

A: The parsing application should follow the white space collapsing rules of the mime type it retrieves. I.e. if it retrieves a "text/html" document, it should do HTML white space collapsing.

-- Tantek

Many of the Questions and Answers are relevant to both ["hCal"] and hCard.

Q: Would it be appropriate to wrap the name of the vCard owner with ? This may give the hCard some added semantic value in the XHTML document.

<span class="agent"> 
 <span class="vcard">
  <span class="email">
   <a class="internet" href="mailto:jfriday@host.com">
    <dfn>
       <span class="fn">Joe Friday</span>
    </dfn>
   </a>
  </span>
  <span class="tel">+1-919-555-7878</span>
  <span class="title">Area Administrator, Assistant</span>
 </span>
</span>

-- Ben Ward

  • If the answer to the above Q is "yes", why not use the following?
<dfn class="fn">Joe Friday</dfn>

or

<span class="agent"> 
 <dfn class="vcard">
  <span class="email">
   <a class="internet" href="mailto:jfriday@host.com">
    <span class="fn">Joe Friday</span>
   </a>
  </span>
  <span class="tel">+1-919-555-7878</span>
  <span class="title">Area Administrator, Assistant</span>
 </dfn>
</span>

This would mark the entire hcard as the "defining instance".

Bob Jonkman 10:07, 13 Jul 2007 (PDT)

Applications

Applications that are hCard aware or can convert hCard to vCard formats.

Copy hCards favelet(s)

  • I think a Favelet would work nicely here. When you find a page that is hCard friendly, you click the favlet and you get yourself a vCard. This is done! See X2V in the implementations section of the hCard spec.

Distributed Commentor Icons

The URL reffered to in this section is no longer available. The thoughts on using icons are however still relevant. WilleRaab 16:55, 23 Jul 2007 (PDT)

  • See using hCards in your blog for an example of hCards used for comment authors (commentors). The system used there, "Gravatars", is a centralized site that serves commentor icons that requires login etc.

What if we gave each commentor the option of hosting their own icon?

A distributed commentor icon implementation could work like this:

  1. Given the URL of a commentor, look for an <address> element with classname of "vcard" at the commentor's URL. The <address> element is supposed to be the contact information for the page (see hCard FAQ for more info), so this makes sense.
  2. Next, look for the first element inside that hcard that has a classname of "logo".
  3. Hopefully that element is an <img>, and if so, use its src to get the commentor's icon.
  4. Presto. You've got distributed commentor icons!

Spam prevention

hCard uses mailto: links, and therefore it automatically "inherits" the disadvantage of mailto: links: These links can be easily detected by emails spiders (used by spammers).

Email addresses are picked up like any other link crawled by a search engine and trustworthy crawlers may be deterred from adding emphasis while indexing these links by including rel="nofollow" (See rel-nofollow). However, email addresses used for spam are crawled by email spiders which will likely ignore this attribute.

There are ways to prevent email address detection by simple email spiders, while still retaining full compatibility with (X)HTML applications. One common way is to "encode" the the "m" of "mail" and "@" with character entities, yet it's unwise to follow a convention of only encoding specific characters because the email spiders can pick up on this too:

Example of the original link:

<a class="email" href="mailto:john.smith@example.com">john.smith@example.com</a> 

Example of the "encoded" link (with rel-nofollow added):

<a class="e&#109;ail" rel="nofollow" href="&#109;ailto:john.smith&#064;example.com">john.smith&#064;example.com</a>

Simple email spiders which do not do character entity decoding will therefore not be able to find your email address.

Note: Perhaps there are or will be email spiders which can decode entities, so the this technique will only help with some (cheap) email spiders. (See also: http://rbach.priv.at/Misc/2005/EmailSpiderTest)

Other prevention methods to consider

  • Using server-side code to implement character entities randomly
  • Displaying the address in a way thought to be only human readable (thus breaking the link):
    • Using an image instead of text (could still be machine readable using OCR)
    • Using human readable text that conveys the need for editing before use (eg PLEASE-NO-SPAM_name@example_NO-SPAM.com)
  • Using javascript for client-side decryption of an encrypted address (requires javascript to be enabled)
  • Pointing to an email form or other URL instead of an email address

Tutorials

  • How to hCard encode entries in Popular blog software.
  • Good reasons to publish your hCard
    • as a business, get people to put you in their address book so they'll find you later
    • as a business with an email list, get people to add you (with email address) to their address book so that your email list works via whitelisting via the address book.

Parsing

See hcard-parsing-brainstorming

Birthday Reminders

  • hCard consumers could calculate the current age of hCard subjects, from the DoB. Andy Mabbett 07:47, 20 Apr 2007 (PDT)
  • for hCards with DoB, hCard consumers could generate and export a recurring hCalendar. Andy Mabbett 08:06, 20 Apr 2007 (PDT)
    • If/ when Date of Death is added to hCard, parsers could instead generate a recurring "death-anniversary" hCalendar. Andy Mabbett 08:08, 20 Apr 2007 (PDT)

Post vCard additions

Keeping hCard properties and values as a 1:1 representation of vCard properties and values has numerous benefits such as simplicity, stability, interoperability with the vast number of existing vCard applications etc.

However some have found vCard to be limiting in terms of the data/properties/fields they want to express in contact information. Some implementations use vCard extensions to express such information [citation needed].

This section is for documentation of such suggested additions. Empirical evidence of actual *real world* examples on the Web of people publishing this information would be a good step towards considering any such additions/extensions.

  • altitude. From hcard-issues.
  • vat-number : for VAT numbers of companies, which are used a lot in Europe and they need to be published on Belgian publications (including websites).

Thus see (and add to): vcard-suggestions

Another path to consider is the development of another microformat which includes an hCard and then extends it with additional properties for a particular domain. In many ways hResume has already done this. Other related efforts:

Using hCard as a stable building block for additional microformats may seem more desirable than incrementally growing hCard itself.

Of course if vCard were extended itself, that may provide impetus to add such extensions to hCard in order to maintain the 1:1 representation of properties/values.

Wikipedia's Persondata

Wikipedia's Persondata aligns very closely with hCard, but has additional date and place of birth & death fields. Andy Mabbett 13:02, 28 Jan 2007 (PST)

TODO

  • The hcard-profile needs verification and perhaps a URL for retrieving the actual XMDP, rather than as <pre> text on a wiki page.
  • Complete translating the examples from the vCard spec into hCard, and place them on a separate hCard examples page.
  • Create a "rich" but realistic hCard example, say for example for a salesperson, who wants to put a whole bunch of contact information on their website in order to be found/contacted easily.
  • Provide examples of how to encode instant messaging (IM) accounts. Figure out what would the mailto: or aim: URL in hCard look like in vCard. And take a look at what vCard applications do today with IM addresses.
  • Clarify contradictory copyright statements, per http://microformats.org/discuss/mail/microformats-discuss/2007-July/010243.html

CSS Styles

Not only can you create semantics with the hCard values, but you can add CSS styles to them as well. You are free to style the terms in any way you want, but here we can list a few ideas for how to style terms.

If you want to encode hCard data, but do NOT want to display it in the HTML code (WARNING: This is very much recommended AGAINST, and in general against the microformat principle of marking up visible data), then you can hide that tag in CSS with the following code:

<span style="display: none">Hidden Data</span>

Transforming applications will still find the data and use it when converting hCards to vCards.


Other Implementations/Ideas

Accepted Suggestions

Encoding Company data as a Business Card (proposal)

( Accepted: http://microformats.org/wiki/hcard#Organization_Contact_Info )

In the wild there are several hCards that do not currently validate because they are businesses that have omitted the "fn" property in favor of the "org" property.

Proposal: hCards representing a business or organization MUST set fn AND org to the same value. Parsers may then use this equivalence, if detected, to treat an hCard as the contact info for a business or organization rather than an individual.

Note that Apple Address Book supports this semantic when importing vCards.

See the Technorati Contact Info for an example.

Implied "FN and N" Optimization (proposal)

Right now a parser first looks for an "n" element.

And then if no "n" is present, look for an "fn" element to use to imply an "n" element per the "implied n property" rules in the spec.

BACKGROUND:

Due to the prevalence of the use of "nicknames" or "handles" on the Web, in actual content published on the Web (e.g. authors of reviews), there has been a discussion about adding a "fn" shortcut to the "n" shortcut that used the "nickname" as a fallback.

PROPOSAL:

We should consider adding one more implied optimization after the steps documented above and that is:

If no "fn" is present either, then look for a "nickname" element to use to imply both the "fn", and the "n/given-name", leaving the "n/family-name" as empty.

This would enable "nickname" only hCards for denoting and individual on a website, which is quite common on blogs and reviews published on the Web.

Implied work tel

Problem

Some phone numbers are not always documented of type 'work'. The type 'work' is usually implied from context.

Examples in the wild

[NVidia contact information]

Only 'Tel' is specified. The fact that it is of type 'work' can be assumed from the context: the name of an organization is present.

<P><B>NVIDIA CORPORATE OFFICE:</B> <BR>
          2701 San Tomas Expressway<BR>
          Santa Clara, CA 95050<BR>
          Tel: 408-486-2000<BR>

          Fax: 408-486-2200<BR>
          ...
        </P>

[Supermarketguru.com]

   <p>
      <font face="Verdana, Helvetica, Arial" size=2>
        <b>Phil Lempert:</b> <a href="mailto:plempert@supermarketguru.com">plempert@supermarketguru.com</a><br>
      </font>
      <font face="Verdana, Helvetica, Arial, sans-serif" size=2>SupermarketGuru.com<br>
          3015 Main Street, Suite 320<BR>Santa Monica, California 90405<br>
          Telephone: 323-860-3070 
      </font>
   </p>

Here only 'Telephone:' is specified, a FN is present ('Phil Lempert') but because an ORG is present ('SupermarketGuru.com'), it can be safely implied that '323-860-3070' is a tel or type work.

Proposal

If an ORG is present in a VCARD, a TEL with no TYPE has an implied TYPE 'work'

Comments

  • Though it may be safe to make that assumption for the given example (and though it might have been wise to make this rule from the outset), we now can't know that it will alwyas be safe to do so, for all pre-existing hCards. Consider people whose organisation represents voluntary work, honorary roles and so forth. Andy Mabbett 00:33, 8 Jan 2008 (PST)

Rejected Suggestions

Suggestion: The use of class="url" on an <a> tag to represent an hCard URL property is redundant. By virtue of the <a> tag you know this is a URL.

Rejected. This is a bad suggestion because although it appears to reduce redunancy and keep things cleaner, it also creates a few problems. Without explicitly noting that this is a URL then any <a> tags within a 'vcard' would be considered a URL, for example:

<span class="vcard">
...
<ul class="categories">
<li><a href="http://w3c.org">W3C</a></li>
</ul>
...
</span>

There is no way to "turn-off" the encoding of the W3C URL, whereas if "url" needed to be explicitly listed in the class attribute list, then by NOT listing it you could effectively turn it off.


References

Normative References

Informative References

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.