Microformats (sometimes abbreviated μF) are simple conventions used to embed semantics in HTML and quickly provide an API to be used by search engines, aggregators, and other tools. These small patterns of HTML are used for marking entities that range from fundamental to domain-specific information, such as people, organizations, events, and locations.
Their simple format is not only useful for machines but it is also readable by any individual.
Several existing libraries have been specifically developed for microformats and they are not limited to hCard and hCalendar.
Microformats are supported by all major search engines.
Microformats, microdata and RDFa
Microdata are a WHATWG HTML specification,which is also used to nest metadata within existing content of web pages.
RDFa is a W3C standard, applying RDF to web pages.
Microformats are of no standard, although hCard and hCalendar conventions are widely used.
Some microformats examples
Adr microformat
The adr
microformat represents an address, either for a physical location or a mailing address.
Properties
The value of each property is either a string or undefined unless anything else is specified.
Property | Description |
---|---|
type |
The type of address. The value is either undefined or a non-empty array where each element is one of the following strings.
|
post-office-box |
The post office box number, if there is one. |
street-address |
The street address or addresses. The value is either undefined or a non-empty array where each element is a string. |
extended-address |
The extended address. |
locality |
The locality for the address. |
region |
The region for the address. |
postal-code |
The postal or ZIP code for the address. |
country-name |
The name of the country in which the address is located. |
Methods
toString()
Returns the address as a string.
Geo microformat
The geo
microformat represents a physical location on the planet Earth using latitude and longitude coordinates.
Properties
If a property is not marked as required, the value might be undefined.
Property | Description |
---|---|
latitude |
The latitude of the geographic location, represented as a floating-point number. Required. |
longitude |
The longitude of the geographic location, represented as a floating-point number. Required. |
Methods
toString()
Returns the location as a string.
geoString = geo.toString();
hCalendar microformat
The hCalendar
microformat represents an appointment or other event on a calendar.
The class name is vevent
. There are two required properties: summary
and dtstart
.
Properties
The value of each property is a string unless anything else is specified. If a property is not marked as required, the value might be undefined.
Microformats.dateFromISO8601
takes a normalized ISO 8601 date as its first parameter and returns the corresponding date.Property | Description |
---|---|
category |
Zero or more categories with which the event is associated. If a category is also a tag microformat, its "tag" property is used. The value is either undefined or a non-empty array where each element is a string. |
class |
The classification of the event. This is one of public , private , or confidential . |
description |
An description of the event, using HTML. The value is some kind of object. |
dtstart |
The date and time at which the event begins, normalized to an ISO8601 date. Required. |
dtend |
The date and time at which the event ends, normalized to an ISO8601 date. |
dtstamp |
The date and time at which the calendar entry was created, normalized to an ISO8601 date. |
duration |
The length of the event. This can be things such as "1w" for one week, or "1h" for one hour. See the description in RFC 2445 for details. |
geo |
A physical location associated with the event. The value is a geo microformat where none of the properties are required. |
location |
A location at which the event is to take place. The value is either a string or an hCard microformat where none of the properties are required. |
status |
The status of the event. This can be one of tentative , confirmed , cancelled . |
summary |
A brief description of the event. Required. |
transp |
Specifies whether or not the event should be ignored when searching for openings in the user's calendar. If this value is transparent , the time occupied by this event is considered to be free when looking for openings in the calendar. If the value is opaque , the time occupied is considered unavailable for assignment. |
uid |
A unique ID for the event. |
url |
A URL associated with the event. |
last-modified |
The date and time at which the event was last modified, normalized to an ISO8601 date. |
rrule |
Specifies recurrence rules for the event. See RFC 2445 for details. I am not sure what the type of the value is. Reading may throw an exception. |
hCard microformat
The hCard
microformat describes an entry in a contact database, as a virtual business card.
Properties
The value of each property is a string unless anything else is specified. If a property is not marked as required, the value might be undefined. If a property is marked as plural, the value is either undefined or a non-empty array. Each element in the array is a string unless anything else is specified. The values of the email
, n
, org
and tel
properties are not fully documented.
Property | Description |
---|---|
adr |
The contact's address. Plural. Each element is an adr microformat where none of the properties are required. |
agent |
People who act as agents on behalf of the contact. Plural. Each element is either a string or an hCard microformat where none of the properties are required. |
bday |
The contact's birthdate. |
class |
A class for the contact. |
category |
Category with which the contact is associated. If a category is also a tag microformat, its "tag" property is used. Plural. |
email |
Zero or more email addresses for the contact. Each email address entry includes two subproperties, both of which are plural:
|
fn |
The contact's full name. Required. |
geo |
The contact's physical location. The value is a geo microformat where none of the properties are required. |
key |
The contact's public key, for exchanging encrypted data with the contact. Plural. |
label |
Formatted text providing an address label for the contact. Plural. |
logo |
Optional URI to a graphic image of a logo for the contact; this can be used for a company logo, for example. Plural. |
mailer |
The type of email software used by the contact. Plural. |
n |
The contact's name. This has the following subproperties:
The |
nickname |
Nickname for the contact. Plural. |
note |
HTML note with additional information about the contact. Plural. Each element is some kind of object. |
org |
The organization with which the contact is associated. This includes the following subproperties:
|
photo |
URI providing a photograph of the contact. Plural. |
rev |
The date and time at which the contact was last revised. |
role |
Role which the contact fills within his or her organization. Plural. |
sequence |
A revision number for the contact. Each time the contact is revised, this number should be incremented, if this property is used at all. (The value is a string) |
sort-string |
If provided, this string is used instead of the fn or n property to determine the sort order for the card. This can be useful in cases where the locale of the contact's name has different sorting rules than other names in the user's contact database. |
sound |
URI specifying a sound file associated with the contact. Plural. |
title |
Job title for the contact. Plural. |
tel |
The contact's telephone number. Plural. Each element has the following subproperties:
|
tz |
The contact's time zone. |
uid |
A unique UID for this contact. |
url |
URL associated with the contact. Plural. |
Tag microformat
The tag
microformat is used to add tags to other microformats.
Properties
The value of each property is a string
.
Property | Description |
---|---|
tag |
The name of the tag. This is the text after the last forward slash in the link. Required. |
link |
A URL associated with the tag. Required. |
text |
The text associated with the tag. Required. |
Methods
toString()
Returns the tag as a string.
See also
- Microformat on Wikipedia
- Microformats official website
- Search engines support on Microformats official website
- IndieWebCamp