File Under: Social

Keep Track of Your Friends With XFN

So far, keeping track of your social relationships on the web has been something that primarily happens on the big social networking sites — Facebook, MySpace and Friendster. They all have different features, but the common thread between those sites is that you can define and manage your relationships with other users on each site.

But what happens to those relationships when you leave Facebook and go surfing around the larger web? How do you stay in touch with your friends and continue to manage those relationships once outside the sealed ecosystem of a social network?

And as popular as they are, we all have a few friends who purposefully avoid the big social networks for whatever reason. Even those people have loose systems for defining their relationships — maybe they have a blog and they keep a “blog roll” or a list of sites they like in the sidebar. It’s much less formal, but it’s analogous to the friends list in a site like Facebook or Friendster (just don’t point that out to them, lest they become even more reclusive).

The web is a big and complicated system of connected data, so surely there’s a structured way to define and manage relationships between people without joining a social network. And in fact there is.

It’s known as XFN, or the XHTML Friends Network. Using a series of different rel tags in your markup, you can indicate who your friends are what the nature of your relationship is.

While not officially part of Microformats, XFN uses some microformat components to define relationships, and the two groups share similar goals.


Contents

  1. An Overview of XFN
    1. What XFN Does
    2. Using XFN
    3. Limitations

An Overview of XFN

You have blog. Your best friend has a blog. Your blog links to your friend’s blog. Beyond that, there’s no way to indicate that that person is your friend. Let’s say you link to your friend’s blog like so:

<a href="http://yourfriendsblog.net/">Bill</a>

And here’s what the same link would look like after we drop in some XFN markup:

<a href="http://yourfriendsblog.net/" rel="friend met">Dave</a>

As you can see, we’ve just added a simple rel tag and defined Dave as a friend that we’ve met. That’s XFN code in action.

The XFN specification has a fairly complete range of options for defining various types of relationship. Some of the more common attributes are:


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


What XFN Does

The primary benefit of XFN is that page scraping tools like search engine spiders can crawl through your code and pick out the various relationships you’ve defined. It gets even more interesting when those spiders follow your links, crawl your friend’s sites and find similar links leading back to you.

The spider then knows that the relationship is symmetrical. In other words, you call Dave a friend and Dave calls you a friend and that relationship is confirmed. When symmetry is established, page crawlers can give the relationship added validity.

Symmetry is also useful with the rel="me" tag, since it allows you to claim all the various pages you may have. Sites like Flickr allow you to enter your blog on your profile page and then mark that up with a rel="me" tag.

If you then link to that same page from your blog, the relationship is symmetrical and a claim of ownership can be assumed. If someone else points to your blog from their Flickr page trying to claim your blog as their own, the lack of a reciprocating link tells a web crawler that the claim is suspect and indexing services will ignore it.

Using XFN

Hand coding your XFN links isn’t that hard, but there is a JavaScript widget that can generate the links for you if you like.

So far, the primary consumers of XFN have been search engine spiders. Some attempts at open social networks like the DiSo project take advantage of the format as well, and Google recently released an oft-overlooked Social Graph API that relies heavily on XFN data.

The Social Graph API is somewhat limited at the moment, but there are some interesting tools you can use to see what sort of relationships you might already have defined. To see what sort of things are possible, have a look at Google’s example applications.


Limitations

While there’s a reasonably wide range of options for defining relationships, there is one common sort of relationship on the web that XFN doesn’t account for — being a fan of someone. For example, I’m a big fan of Ze Frank. But I’ve never met Ze Frank, and XFN doesn’t offer a way to define that relationship.

There is a proposed solution, though for the time being it only allows the reverse. For instance if someone is a fan of you, you can add a rel="fan" tag to your outbound link. Unfortunately the opposite — claiming fanship of somebody else — isn’t possible.

There are of course further fringe cases which also can’t be defined (one particular instance, a child with legal guardians rather than parents, has been accepted and will be implemented in the future), but the XFN group has done a good job of preventing the list of definitions from getting too out of hand. If you have a compelling argument for including something, you can always join the group and add your suggestions.