Why Microformats?

University of Wisconsin - Platteville

Why Microformats?

Web 2008



Presentation and documentation are online @

http://www.uwplatt.edu/web/presentations

The Definition

Microformats Microformats

... a set of simple open data format standards that many are actively developing and implementing for more/better structured blogging and web microcontent publishing in general.

The Origin

As legend has it at the 2004 SxSW conference...

Eric Meyer, Tantek Çelik and Matthew Mullenweg had a hallway discussion.

The discussion was about an asterisk * next to names of people they had 'met' IRL.

Their discussion turned into the very first microformat:
XHTML Friends Network (XFN)

Microformat Principles

  • Solve a specific problem
  • Start simply
  • Design for humans first, machines second
  • Reuse currently adopted standards
  • Modular and embeddable
  • Encourage decentralized development, content and services

The Problem

  • Too much (disparate) information
    • 20+ BILLION indexed items in Google (as of 2006)
    • Opinions, information and reviews hosted everywhere
    • No centrally 'controlled' system of info
  • Keyword searching only:
    1 - 10 of about 313,000 for "why microformats?"
  • (un)Semantic Web
Information is stored everywhere and not in the same format, same website, or using the same technologies. Without that structure, how do we ever find anything?

The Problem

How do we markup information with richer semantics without breaking what we already have?

Where to Begin?

  • We begin with POSH
  • Victoria Beckham
  • NO, no, noooo.
    Not that spice one!

POSH

  • Plain
  • Old
  • Semantic
  • HTML
  • The acronym POSH was coined as a shorthand abbreviation for "plain old semantic HTML".

Why POSH?

Put simply, it's Web Standards!

Web Standards Project

Most of us have been doing web standards for years. If you are new, I recommend, The Web Standards Project for more info.

The POSH Checklist

XFN History

*

XFN: Origin

Bloggers started to mark people they had 'met' with an asterisk in their Blogroll.

Blogroll: list of blog site you read.

XFN: Concept

By using the approved "rel" attribute in the anchor tag, we move from this:

<li><a href="http://www.meyerweb.com">Eric Meyer</a> *</li> <li><a href="http://johnfallsopp.com/">John Allsopp</a></li>

To the semantic XFN:

<li><a href="http://www.meyerweb.com" rel="met">Eric Meyer</a></li> <li><a href="http://johnfallsopp.com/">John Allsopp</a></li>

XFN: Original CSS

The XHTML blogroll:

<li><a href="http://www.meyerweb.com" rel="met">Eric Meyer</a></li> <li><a href="http://johnfallsopp.com/">John Allsopp</a></li>

The CSS to do what was already happening:

a[rel~="met"]:after {content:" *";}

XFN: Extends

  • friendship (pick 1)
    • contact
    • acquaintance
    • friend
  • physical
    • met
  • professional
    • co-worker
    • colleague
  • geographical (pick 1)
    • co-resident
    • neighbor
  • family (pick 1)
    • child
    • parent
    • sibling
    • spouse
    • kin
  • romantic
    • muse
    • crush
    • date
    • sweetheart
  • identity
    • me

The Problem: Contacts

Imagine that you put contact info on a website.

George W. Bush<br /> The White House<br /> 1600 Pennsylvania Avenue NW<br /> Washington, DC 20500<br /><br />

As a human, we interpret that information as contact info because we adapt and infer meaning.

Contacts: Problems

Computers 'display' the information, however they don't know the meaning.

The Internet Engineering Task Force (IETF) has developed a standard for contact information:

vCard (RFC 2426)

Contacts: vCard

Computers understand specific code:

BEGIN:VCARD VERSION:3.0 N;CHARSET=UTF-8:Bush;George;W;; ORG;CHARSET=UTF-8:The White House FN;CHARSET=UTF-8:George W Bush UID: ADR;CHARSET=UTF-8:;;1600 Pennsylvania Ave NW;Washington;DC;20500;USA END:VCARD

What... the... heck... is... THIS???

Re-using Contact Standards

The vCard format has some very specific properties that we can re-use:

  • post-office-box
  • extended-address
  • street-address
  • locality
  • region
  • postal-code
  • country-name

Contact Conversion: vCard to hCard

So we re-use the properties established by the IETF on vCard and put them directly into XHTML

We can use the 'class' attributes hold the vCard properties.

When they are put together, it forms: hCard (XHTML structred vCard)

Address: hCard

<div class="vcard"> <span class="fn n"> <span class="given-name">George</span> <span class="additional-name">W</span> <span class="family-name">Bush</span> </span> <div class="adr"> <div class="street-address">1600 Pennsylvania Ave NW</div> <span class="locality">Washington</span>, <span class="region">DC</span> <span class="postal-code">20500</span> </div> </div>

hCard: REQUIRED Properties

The following are the REQUIRED "class" properties:

  • fn - formatted name
  • n (family-name, given-name, additional-name, honorific-prefix, honorific-suffix)

hCard: Optional Properties

Optional:

  • nickname, sort-string
  • url, email (type, value), tel (type, value)
  • adr (post-office-box, extended-address, street-address, locality, region, postal-code, country-name, type, value), label
  • geo (latitude, longitude), tz
  • photo, logo, sound, bday
  • title, role, org (organization-name, organization-unit)
  • category, note, class, key, mailer, uid, rev

hCard: Flexible

Though our example hCard seemed very structured, hCard (and all microformats) are FLEXIBLE!

A basic hCard can be written like this:

<div class="vcard"> <span class="fn n">Mark Greenfield</span> </div>

Use "div" when you need a block element

Use "span" when you need an inline element

hCard: Flexible

A basic hCard email can be written like this:

<span class="vcard"> <a href="mailto:markgr@buffalo.edu" class="fn n email"> Mark Greenfield</a> </span>

Use "div" when you need a block element

Use "span" when you need an inline element

hCard: Conversion

<h4>Mark Greenfield</h4> <ul> <li>Director of Web Services</li> <li>Work: <a href="mailto:markgr@buffalo.edu"> markgr@buffalo.edu</a></li> <li>Office: (716) 645-2811</li> </ul>

hCard: Conversion Start

<div class="vcard"> <h4 class="fn n">Mark Greenfield</h4> <ul> <li class="title">Director of Web Services</li> <li>Work: <a href="mailto:markgr@buffalo.edu" class="email"> markgr@buffalo.edu</a></li> <li>Office: <span class="tel">(716) 645-2811</span></li> </ul> </div>

hCard: Conversion Full

<div class="vcard"> <h4 class="fn n"><span class="given-name">Mark</span> <span class="family-name">Greenfield</span></h4> <ul> <li class="title">Director of Web Services</li> <li class="email"><span class="type">Work</span>: <a href="mailto:markgr@buffalo.edu" class="value"> markgr@buffalo.edu</a></li> <li class="tel"><span class="type">Office</span>: <span class="value">(716) 645-2811</span></li> </ul> </div>

hCard: Business Card CSS

With a valid hCard, you can even generate a very nice looking business card!

hCard Nicole Kahl

hCard example

Firefox Add On: + Operator

To see Microformats in action, get the Operator Add On

Operator

The best part is the Operator Add On can be extended with user scripts.

Events

Event information can be microformatted too!

IETF to the rescue again through: iCalendar (RFC 2445)

The "root" of any event is vevent

The "root" of any calendar is a vCalendar

XHTML formated iCalendar is hCalendar

hCalendar: REQUIRED Properties

The following are the REQUIRED "class" properties:

  • dtstart "date start" (ISO date)
  • summary

ISO date: International standard date notation is:

  • YYYY-MM-DD OR YYYYMMDD
  • YYYY-MM-DD hh:mm:ss OR YYYYMMDDThhmmss
  • YYYY-MM OR YYYYMM
  • YYYY

hCalendar: Optional Properties

  • location
  • url
  • dtend (ISO date), duration (ISO date duration)
  • rdate, rrule
  • category, description
  • uid
  • geo (latitude, longitude)

hCalendar: Example

<div class="vevent"> <a class="url" href="http://webconference.psu.edu/"> http://webconference.psu.edu/</a> <span class="summary">Uncommon Sense</span>: <abbr class="dtstart" title="2008-06-09">June 9</abbr>- <abbr class="dtend" title="2008-06-10">10</abbr>, at the <span class="location">Penn Stater Conference Center, State College, PA</span> </div>
http://webconference.psu.edu/ Uncommon Sense: June 9- 10, at the Penn Stater Conference Center, State College, PA

hCalendar Contacts

<div class="vevent"> <a class="url" href="http://webconference.psu.edu/"> http://webconference.psu.edu/</a> <span class="summary">Uncommon Sense</span>: <abbr class="dtstart" title="2008-06-09">June 9</abbr>- <abbr class="dtend" title="2008-06-10">10</abbr>, at the <span class="location">Penn Stater Conference Center, State College, PA</span> <div class="vcard contact">Contact: <a href="mailto:kmh@psu.edu" class="fn n email"> Karen Hackett</a> </div> </div>

hCard Misc.

Not only can you mark up contacts, but you can also add a vcard for location.

<div class="vcard location"> ... </div>

You can also group events together into a full calendar.

<div class="vcalendar"> <div class="vevent"> [Event 1] </div> <div class="vevent"> [Event 2] </div> ... </div>

Microformat Sidekicks: rel & rev

rel

rel - describes the relationship of the anchor's href to the current document

rev

rev - a reverse link from the author specified by the href to the current document

rel & rev

Both allow authors to define additional link 'types'

rel: <a href="#" rel="?" />

  • rel="license" - i.e. Creative Commons, copyright info links, etc.
  • rel="tag" - links to anysite that utilizes tags
    • <a href="http://flickr.com" rel="tag">PSUweb2008</a>
    • <a href="http://technorati.com/tag/casa" rel="tag" lang="es">casa</a>

rev: <a href="#" rev="?" />

  • rev="vote-for" - in favor of the following idea / document
  • rev="vote-against" - against the following idea / document
  • rev="vote-abstain" - no opinion on the following idea / document
  • My vote is for <a href="http://www.packers.com" rev="vote-for"> Green Bay</a> over <a href="http://www.bears.com" rev="vote-against"> Chicago</a>.

hReview - draft

  • version - optional [text - current 0.3]
  • summary - optional [text]
  • type - optional [product | business | event | person | place | website | url]
  • item - REQUIRED uses [fn (url || photo) | hCard (for business or person) | hCalendar (for event)]
  • reviewer - optional uses [hCard]
  • dtreviewed - optional uses [ISO (8601)]
  • rating - optional [fixed point integer (1.0-5.0) | worst (1.0) | best (5.0) | value (explicit)]

hReview rating

Ratings can be customized if you wish.

<p class="hreview">My rating on the <a href="http://www.garmin.com" class="item fn url" rel="tag"> Garmin Colorado 300</a></span> <span class="type">product</span> is a <span class="rating"><span class="value">9</span> out of <span class="best">10</span>. <span class="summary">Great GPS Unit, though a bit pricey!</span></p>

hResume - draft

  • summary - optional [text]
  • contact - REQUIRED [<address> + hCard]
  • experience - optional [hCalendar with events and hCard for company]
  • education - optional [hCalendar with events and hCard for school]
  • skill - optional [rel-tag keywords or phrases]
  • affiliations - optional [hCard of the organization]
  • publications - optional [<cite>]

Additional Help

When in doubt, go back to the source:

  • John Allsopp's book, "Microformats - Empowering Your Markup for Web 2.0"
  • http://www.microformats.org
    • Specifications, Discussions, Wiki, and Microformats "In the Wild"
    • Microformat generator forms

Microformats Revisited

  • Solve a specific problem
  • Start simply
  • Design for humans first, machines second
  • Reuse currently adopted standards
  • Modular and embeddable
  • Encourage decentralized development, content and services

The Chaos

"The less people know about how sausages and laws are made, the better they'll sleep at night."

Otto von Vismark, Minister-President of Prussia

Microformats

They may seem to be chaotic, however we are following currently approved recommendations and adopting them to the web.

Microformats are still in their infancy, but the potential is incredible!

Why Microformats?

???

Why Microformats?



Presentation and documentation are online @

http://www.uwplatt.edu/web/presentations


Email: frommelt@uwplatt.edu

Copyright Information

Copyright Daniel M. Frommelt, 2008. This work is the intellectual property of the author. Permission is granted for this material to be shared for non-commercial, educational purposes, provided that this copyright statement appears on the reproduced materials and notice is given that the copying is by permission of the author. To disseminate otherwise or to republish requires written permission from the author.