hcard-faq: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(→‎Q&A: Added note about 'Redirect')
m (added Q&A re: plural properties)
Line 9: Line 9:
# ''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?''
# ''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?''
#* The classname "url" is necessary to explicitly distinguish hyperlinks that are URL elements for the hCard, from email hyperlinks, as well as hyperlinks to photos, or other random hyperlinks that happen to be inside the hCard.
#* The classname "url" is necessary to explicitly distinguish hyperlinks that are URL elements for the hCard, from email hyperlinks, as well as hyperlinks to photos, or other random hyperlinks that happen to be inside the hCard.
# 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?
# ''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?''
#* You can use .HTACCESS to rewrite links to your vCard to a webservice that converts a page to the vCard dynamically, to do this you need to add something similar to your .htaccess file
#* You can use .HTACCESS to rewrite links to your vCard to a webservice that converts a page to the vCard dynamically, to do this you need to add something similar to your .htaccess file
<pre>
<pre>
Line 21: Line 21:
Redirect /path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
Redirect /path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
</pre>
</pre>
#4 ''Is there a list of all hCard properties which can be plural?
#* We have avoided *duplicating* (or providing a shortcut for) the "can this property occur multiple times or not" deliberately in order to avoid repeating a constraint from RFC 2426 vCard, and thus potentially getting it wrong.  Here is the way to determine whether or not a particular property can occur multiple times (is a plural property / may have multiple instances or values).
#*# Check the [[hcard-profile|hCard XMDP profile]] for the property definition.
#*# If the property definition references a plural form in RFC 2426 (e.g. honorific-suffix references honorific suffixes), then the property is a plural property.
#*# Else go check the referenced section in RFC 2426 which should state explicitly whether or not the property is plural or singular.
#*# Else (if RFC 2426 is *not* explicit) then the property is plural.

Revision as of 19:35, 4 November 2005

hCard FAQ

This page is for documenting Q&A about hCard. If you have a new question to ask, Please consider first asking your question on the microformats-discuss list.

Q&A

  1. Should I use the more semantic <address> element for my hCards?
    • Yes the <address> element is more semantic, but it is too specifically semantic for most hCard uses. The poorly named <address> element really means <contact-info-for-this-web-page>. The HTML4 definition of the ADDRESS element says it is used "to supply contact information for a document or a major part of a document such as a form." Therefore <address> should be used for an hCard ONLY IF that hCard represents the contact information for the page or major part thereof. One example of such a usage is on Tantek's blog. Another way of saying this is the following two statements: Every <address> on a page SHOULD be an hCard. But not every hCard should be an <address>.
  2. 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?
    • The classname "url" is necessary to explicitly distinguish hyperlinks that are URL elements for the hCard, from email hyperlinks, as well as hyperlinks to photos, or other random hyperlinks that happen to be inside the hCard.
  3. 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?
    • You can use .HTACCESS to rewrite links to your vCard to a webservice that converts a page to the vCard dynamically, to do this you need to add something similar to your .htaccess file
RewriteRule ^path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php\?uri=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://suda.co.uk/projects/X2V/get-vcard.php?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
  1. 4 Is there a list of all hCard properties which can be plural?
    • We have avoided *duplicating* (or providing a shortcut for) the "can this property occur multiple times or not" deliberately in order to avoid repeating a constraint from RFC 2426 vCard, and thus potentially getting it wrong. Here is the way to determine whether or not a particular property can occur multiple times (is a plural property / may have multiple instances or values).
      1. Check the hCard XMDP profile for the property definition.
      2. If the property definition references a plural form in RFC 2426 (e.g. honorific-suffix references honorific suffixes), then the property is a plural property.
      3. Else go check the referenced section in RFC 2426 which should state explicitly whether or not the property is plural or singular.
      4. Else (if RFC 2426 is *not* explicit) then the property is plural.