Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > CSS

Microformats Made Simple: XFN

Emily P. Lewis focuses on using the rel attribute for links in order to define social relationships, starting with an explanation of XFN.
This chapter is from the book

This chapter is from the book

In the last chapter, we examined how to define links using rel-based microformats and VoteLinks, which uses the rev attribute. Now we will focus on using the rel attribute for links in order to define social relationships.

What Is XFN?

XFN (XHTML Friends Network) is another elemental microformat—it uses just one attribute-value pair—that defines link relationships. But unlike the rel-based microformats, which describe relationships of href destinations to pages, XFN describes social relationships among people.

Developed by the Global Multimedia Protocols Group (GMPG), XFN evolved in response to the blogroll trend, where content authors publish links to other sites they recommend. Often these blogrolls are links to personal sites and blogs (hence the name) that are representative of the people behind them. In effect, these URLs are part of people's online identities.

XFN was created in order to represent these online identities through links, using the rel attribute and a standard set of keywords (values) that describe the relationships you, as the content author, have with the people whose sites you link to. Such relationships include whether you have physically met that person, if that person is a friend or colleague, even if that person is a family member or significant other.

Benefits of the social web

As much as I detest the term Web 2.0 (I think I just threw up in my mouth a little), it has come to represent, in part, the emergence of online social media. This includes everything from user-generated content to popular social networks like Facebook and Twitter.

XFN, too, is a part of this social web. Because it is used to describe human relationships, it supports the creation and extension of social networks. Web tools can crawl the web, searching for XFN links, and discover the social relationships among people, such as the following:

  • Dick and Jane have met and they are friends
  • Brad and Angelina are spouses
  • A Blog Not Limited and @emilylewis are the same person

Let's consider the Google Social Graph API (Application Programming Interface), which drives Google's My Connections service. With My Connections, you enter a few of your own URLs (such as that for your blog, your portfolio, and your Twitter profile page), and it uses the Social Graph API to gather links from other people with whom you've indicated a social relationship (via XFN). It also returns information about the people who have indicated, via XFN, relationships with you, including reciprocal relationships (Figure 4.1).

Figure 4.1

Figure 4.1 Google's My Connections displays my XFN social connections gathered from my blog, Twitter profile, and design portfolio.

Even better, you can use this Social Graph API to create your own social network without having to code your own application, access other APIs, or scrape sites for data. Google's Social Graph API has already indexed the sites and relationships.

And XFN is already widely used. The majority of social networking sites use XFN to describe the relationships between friends and followers using the XFN contact or friend values (assigned to links as rel="contact" and rel="friend", respectively).

Benefits of identity consolidation

Nowadays, particularly with the emergence of social networks, people exist on many different and disparate sites. You may have a blog, a Twitter profile, a Facebook page, and more. With all of these distributed sites, a user may want a way to indicate that each site represents the same person. This is known as identity consolidation, and XFN supports it.

One of the values for XFN is me (assigned to links as rel="me"). By assigning this value to the links to all of your online "identities," you are indicating that each site represents you, effectively consolidating your identity without having to centrally maintain that information.

The key to identity consolidation with rel="me" is that each site in your online identity must have this XFN value applied. The logic is where any site claims another site, the identity between the two is consolidated.

This isn't too difficult. On your own sites, you control the content and can add rel="me" where relevant. And already, many sites and services apply rel="me" to links to their users' profile pages to support identity consolidation, including Flickr, Twitter, LinkedIn, Plaxo, and ClaimID. As such, web applications can gather all of your rel="me" links to create a single profile about you.

One social service that leverages the full power of identity consolidation via XFN is Huffduffer, the audio podcasting service. It utilizes Google's Social Graph API to gather reciprocal rel="me" links from a single URL (namely, your own blog or site) in order to generate a list of "elsewhere" links (such as Twitter and Flickr) on users' profiles.

So, when you create an account at Huffduffer, you enter a URL for one of your websites, and the Social Graph API then returns a list of all other sites that belong to you, based on the presence of the XFN rel="me".

The beauty of this is that instead of editing your profile manually to include links for yourself, Huffduffer does it for you automatically, saving time and ensuring you don't have to maintain that data within the application (Figure 4.2).

Figure 4.2

Figure 4.2 My Huffduffer profile's Elsewhere links gathered via the Social Graph API

Everything has challenges

Of course, despite these powerful benefits, XFN faces some challenges:

  • There are 18 XFN values; however, the two most commonly used are friend and contact, making some folks question the semantic value of the other 16 values.
  • Some people believe there isn't enough semantic distinction between friend and contact.
  • Others suggest more values are needed to indicate narrower professional relationships beyond co-worker and colleague, such as "manager" or "subordinate."
  • There isn't a way to indicate how a relationship may change over time, such as an "ex-friend."

Regarding the first point, I truly believe that as more people adopt XFN, the use of those remaining 16 values will increase and, with it, more tools will parse and extract information for those types of relationships. Kind of a "build it and they will come" perspective.

For the other concerns, I believe people are missing the point about microformats in general: they are intended to be simple and address the majority of use-cases, not all.

Adding more values to XFN, in my opinion, would convolute the microformat and go against simplicity. In the case of professional relationships, managers are co-workers, just as subordinates are; co-worker is a global value that encompasses both managers and subordinates. I don't see the need to get any more specific. Plus, XFN doesn't prohibit you from assigning to your rel attribute a value of "manager," which you can then use to customize your own web application to extract that particular data.

Finally, in the case of changed relationships, I believe that because XFN is assigned to links at a given point in time, the indicated relationship is relevant at the time the link was created. If the relationship changes over time, the XFN values assigned to links can change, thus suggesting that changed relationship.

Now that we've covered the good and the (not really) bad, let's take a look at XFN in detail, starting with the profile.


XFN has its own profile that you should reference in the <head> of your documents:

<head profile="">


The XFN syntax should be very familiar to you, since it is identical to that of the rel-based microformats. You simply add the rel attribute to links referencing other people, and apply the appropriate XFN value to indicate your relationships with those people.

For example, I often include links on my blog to my friends' sites, and I apply rel="friend" to those links:

<a href="" rel="friend">Chris

Most of the time, though, I have more than one XFN relationship with those friends. For those cases, I can list more than one value, each separated in my markup with a space:

<a href="" rel="friend met

colleague">Chris Harrison</a>

This compound XFN statement says:

  • Chris is a friend of mine.
  • I have met Chris.
  • Chris is my colleague.

It is worth noting that for these compound XFN statements, the order of the values is irrelevant. Just be sure to separate each with a space so that all of the values can be parsed correctly.

Understanding the values

The XFN values are listed in Table 4.1 above, but their meaning may not be entirely clear to you, so let me explain them.

Table 4.1. XFN Values


Friendship (one value)

Professional (one or both values)

Family (one value)

Romantic (any or all values)


Geographic (one value)




















The only value that falls under the identity category is me, which I've discussed in reference to identity consolidation. You apply it to links that reference URLs about you: your blog, your tumblelog, your design portfolio, or any site about you.

The one XFN value that should exist on its own is me. Yes, by some lines of thinking you have met yourself and you may even be a friend to yourself. However, these values are pretty much assumed. But hey, two thumbs up for good self-esteem and being your own friend!


Of the three values in the friendship category, you can use only one:

  • contact is the least intimate of the friendship relationships. It is basically someone for whom you have basic contact information, such as their name and, maybe, a URL to their site.
  • acquaintance indicates someone with whom you are familiar and who is familiar with you. It's just a step above contact in terms of intimacy.
  • friend is the most intimate friendship value, but it is largely defined by personal parameters. For me, it includes people I've known for years, as well as those I know more casually but who are more than just contacts or acquaintances.


You can use either one or both of the values in the professional category:

  • colleague is a professional peer, someone with whom you share professional skills and/or interests.
  • co-worker is someone you work with for the same employer.


From the five family XFN values, you can use only one:

  • kin is any relative, whether by blood, marriage, or adoption.
  • spouse is someone to whom you are married. However, it does not require legal marriage. It can also be someone to whom you feel you are married, such as gay couples who aren't legally allowed to marry or folks in common-law marriages.
  • child is anyone you parent, and applies to both biological and adoptive children.
  • parent is someone—again, either biological or adoptive—who parented you.
  • sibling is someone with whom you share a parent, either through biology, marriage, or adoption.


You can use any one or all of the values in the romantic category:

  • muse is someone who inspires you. Now I admit that, at the outset, it seems strange to categorize this as romantic. However, the value falls under the comparative definition of romantic with rational, the thinking being that inspiration isn't rational, so it must be romantic.
  • crush is someone to whom you are attracted but doesn't return the feeling. And, in my case, someone who doesn't even know you are alive (ah, Hugh Jackman).
  • date is someone you date on a regular basis, where there isn't (yet?) a commitment to the relationship.
  • sweetheart is someone to whom you are committed and are physically and/or emotionally intimate.


The only physical value is met, and it refers to people you have actually met in person (so that would not be the guy in the chat room you just met online).


Of the two geographic values, you can use only one:

  • neighbor is someone who lives near you, but not at the same street address. This value has broad definitions: you may consider someone who lives in your condo building a neighbor, as well as someone who lives several blocks away.
  • co-resident is someone with whom you share a street address, such as a roommate.

Another thing worth noting is that XFN doesn't require reciprocity. If you reference a person as a date and they reference you as a friend, it has no impact on the ability for machines to work with XFN. However, it may be time to have a "where are we in this relationship" conversation with that person.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020