A Touch of Class

f. rainne
2004-09-22

Link Types for RSS and Atom Feeds

The myriad Sources of feed format "standardization" are standardizing on a way to <link> HTML pages to syndication feeds. How or where this is happening for RSS, I have no idea. Atom, however, is gathering around Mark Pilgrim's Autodiscovery IETF Draft:

<link rel="alternate"
      href="/atom/feed/uri"
      type="application/atom+xml"
      title="Feed Title">

There's one major problem with this method, and that's the requirement that rel="alternate" — or at least contain alternate as one of the link types in its space-separated list.

alternate is defined to mean "this is a link to an alternate representation of the same content". Examples are: a different file format (e.g. plaintext or PDF), translations (e.g. French or Chinese), versions suited to other media (e.g. optimized for printing or handhelds). Links to to news feeds usually fit under the first category: they're an alternate format of essentially the same content as the linking page. Examples of this are the typical weblog's recent entries page or news site's recent headlines page or open source project's suggested hacker starting bugs list. On these pages, rel="alternate" is entirely appropriate and should be encouraged.

Sometimes, however, a webmaster may decide to add feeds that aren't alternate representations of the page. They may be feeds that form a minor part of the page (like on mozilla.org right now), or that represent content linked from the page but not present in it. These feeds should not get rel="alternate" because they don't represent the alternate semantic.

Specifying that a <link> represents a link to a newsfeed should instead be done just by using an appropriate value (e.g. application/atom+xml or application/rss+xml) for the type attribute. Note that specifying text/xml in the type attribute is insufficient for this: <link rel="alternate" href="xml-version" type="text/xml"> could just as validly be linking to a DocBook edition of the page rather than an RSS one. (Whether the server actually serves the file as text/xml or under a more precise Content-Type header is a separate matter.)

Further Reading

Say what you mean so that you mean what you say.