Microformats in HTML5

This page is to document future use of microformats in HTML5. None of the items documented are supported now, and may change upon proper development within the microformats community, or changes in the HTML 5 specification. This page is to track HTML5 enabled enhancements to microformats, and issues that HTML5 raises. It may be used to track issues which we need to push back into the HTML 5 development process.

If there are things that microformats would like to mark up that aren't handled by HTML5 explicitly, please let the WHATWG know, so we can improve HTML5. This is how the time element came to be, for instance.

New features in HTML5

time element

time element for representing date times. In HTML5, the machine form of datetimes can be represented natively. In some cases it may be possible to replace the date-time design pattern with native HTML5.

Recommendation: Use the value-class-pattern, in particular preferably date-time-separation for accessibly marking up dates and times while following the DRYprinciple as much as possible.

There was briefly an optional pubdate attribute, to indicate the publication date of an article, but it was dropped in 2012 since it is both unnecessary and insufficient. Rather than use the one-off pubdate attribute, it's much better to:

Use the hAtom microformat for articles, and the hAtom published property, as well as the hAtom updated property.

article element

article element for major, independent compositions of content within a page. Perhaps synonymous with hAtomhentry. Could be parsed as hentry within explicit hfeed blocks?

data attributes

data- naming convention for tag attributes. the draft specification states that any attribute that starts with "data-" will be treated as a storage area for private data.

Note that the data-* stuff is explicitly not for microformats. Those attributes are defined in such a way that browsers will never do anything special with them, ever. They are intended for script authors to have a space in which they can play without ever clashing with anything the browser does. There may be some cases of private poshformats that are never intended for interchange that may be used in data-* attributes.

Since data-* attributes are not for general data interchange or generic APIs supported by multiple sites / pieces of software, what are actual valid uses of data-* attributes? One example (feel free to add more)

Twitter's use of data-* attributes in markup to be picked up only by Twitter's javascript library for Tweet buttons, e.g. data-related="indiewebcamp" - indicates @indiewebcamp is a related Twitter account for a tweet button.

new semantic elements

HTML5 has numerous new semantic elements.

Most microformats parsers probably won't recognize those elements and may ignore them - so avoid using microformats classes on new HTML5 semantic elements for anything in production.

HOWEVER, do try experimenting with microformats and new semantic HTML5,

AND try http://dev.h2vx.com/ (the beta version of H2VX) as it now has preliminary support for the new semantic HTML5 elements as well as <time datetime>.

Changes in HTML5

The rel/rev attributes

The rev attribute has been removed from HTML5. The rel attribute can be still be used in the same way, but microformats that assumed the existence of rev and thus only defined a single forward-facing relation may need to be changed to include an opposite relation as well. That is, for every relation that goes in one direction (e.g. rel-parent of xfn), you must explicitly name and define the inverse relationship (e.g. rel-child of xfn) if the inverse relation is indeed useful.

Additions beyond HTML5

microdata

microdata is an extension to HTML5 that provides a set of attributes and associated DOM APIs for semantically marking up and extracting data from existing content in web pages, similar to microformats but with new attributes.

Current microformat compatibility

There seems to be no issue with current implementation of the following microformats in HTML 5:

Requests

"how to use with HTML5" sections that include (a) microformats examples that use HTML5, and (b) microformats parsing details that specify what to do (if anything special is required) with HTML5 elements (e.g. how to parse the time element for dates and times for microformats). See (and add to if necessary) :

if nothing special is required for HTML5, then after performing the analysis, that should be noted as well, for the purpose of clarity.

Issues

The profile attribute has been removed. In HTML, the profile attribute from the head has been removed, with no direct replacement. This causes issues for GRDDL support. It's been suggested that profile URLs be represented in link elements instead, or even as a custom HTTP header. See grddl and profile-uris

See rel-profile which is the replacement for the profile attribute. Tantek 23:24, 5 November 2009 (UTC)

Microdata itemprop duplicates class data. the new attribute itemprop is designed to hold some meaningful data about an element, but class already exists to hold this data. Unsure of reasons why itemprop required?

This is because microdata is designed to be generically parsable, even when the parser does not understand the vocabulary. As such, property names have to be on an explicit attribute, not shared with other, non-data classnames. --BenWard 21:12, 4 September 2009 (UTC)