When I write here at adactio.com, I often sprinkle in some microformats. As I wrote in Natural Language hCard, I’ve developed a sense of smell for microformats:
Once I started looking for it, I started seeing identity and event information in lots of places… even when it doesn’t explicitly look like cards or calendars.
If I’m linking to somebody using their full formated name, then it’s a no-brainer that I’ll turn that into an hCard:
<span class="vcard">
<a class="fn url" href="http://example.com/">
Joe Bloggs
</a>
</span>
But what if I don’t want want to use the full name? It would sound somewhat stilted if I wrote:
I was chatting with Richard Rutter the other day…
When you work alongside someone every day, it sounds downright weird to always refer to them by their full name. It’s much more natural for me to write:
I was chatting with Richard the other day…
I would still make his name a hyperlink but what can I do about making this text into an hCard? Should I change my writing style and refer to everyone by their full formated name even if the context and writing style would favour just using their first name?
Enter the abbr
element:
I can write “Richard” in my body text and use the semantics of (X)HTML to indicate that this is the abbreviated form of “Richard Rutter”:
<abbr title="Richard Rutter">
Richard
</abbr>
From there, it’s a simple step to providing an hCard containing the formated name without compromising the flow of my text:
<span class="vcard">
<a class="url" href="http://clagnut.com/">
<abbr class="fn" title="Richard Rutter">
Richard
</abbr>
</a>
</span>
Now a parser will have to do some extra legwork to find the formated name within the title
attribute of the abbr
element rather than in the text between the opening and closing tags of whatever element has a class
of “fn”. But that’s okay. That’s all part of the microformats philosophy:
Designed for humans first and machines second
Specifically, humans who publish first, machines that parse second.
If I were to link off to Richard’s site from here, I’d also combine my microformats: hCard + XFN:
<span class="vcard">
<a class="url" rel="friend met co-worker" href="http://clagnut.com/">
<abbr class="fn" title="Richard Rutter">
Richard
</abbr>
</a>
</span>
Now I’ve got a bounty of semantic richness:
- an abbreviation—the W3C’s semantic data extractor is a nice way of checking the semantic richness of your documents,
- contact information—this can be converted and exported using Technorati’s service, the Operator plug-in for Firefox or the cross-browser microformats bookmarklet and
- relationship data—this can be plotted visually using XFN graph.
All of that in one word of one clause of one sentence:
I was chatting with Richard the other day…