Exploring Social Connections with XFN

With a bit of context established for how microformats fit into the overall web space, let’s now turn to some practical applications of XFN, which is by far the most popular microformat you’re likely to encounter. As you already know, XFN is a means of identifying relationships to other people by including a few keywords in the rel attribute of an anchor tag. XFN is commonly used in blogs, and particularly in “blogroll” plug-ins such as those offered by WordPress.[10] Consider the following HTML content, shown in Example 2-1, that might be present in a blogroll.

Example 2-1. Example XFN markup

<div>
    <a href="http://example.org/matthew" rel="me">Matthew</a>
    <a href="http://example.com/users/jc" rel="friend met">J.C.</a>
    <a href="http://example.com/users/abe" rel="friend met co-worker">Abe</a>
    <a href="http://example.net/~baseeret" rel="spouse met">Baseeret</a>
    <a href="http://example.net/~lindsaybelle" rel="child met">Lindsay Belle</a>
    </div>

From reading the content in the rel tags, it’s hopefully pretty obvious what the relationships are between the various people. Namely, some guy named Matthew has a couple of friends, a spouse, and a child. He works with one of these friends and has met everyone in “real life” (which wouldn’t be the case for a strictly online associate). Apart from using a well-defined vocabulary, that’s about all there is to XFN. The good news is that it’s deceptively simple, yet incredibly powerful when ...

Get Mining the Social Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.