Please leave your sense of logic at the door, thanks!

Archive for December, 2006

Feed Autodiscovery

Sunday, December 3rd, 2006

We’ve recently added link types to HTML 5. In particular we defined the mechanism for syndication feed autodiscovery. Autodiscovery has become widely deployed and implemented already since its inception in 2002, using the link element with the alternate relationship and a type attribute indicating the format of the feed.

<link rel="alternate" type="application/atom+xml"
      href="/feed.atom" title="Atom Feed">
<link rel="alternate" type="application/rss+xml"
      href="/feed.rss" title="RSS Feed">

For backwards compatibility, we must retain support for, and explicitly define, that method. However, there are two main issues with using the alternate relationship:

To address this issue, we have introduced a new feed relationship which indicates that the referenced document is a syndication feed. This now allows you to link to several different feeds containing different content which are not necessarily alternate versions of the page.

<link rel="feed" type="application/atom+xml"
      href="/feed/comments" title="All comments">
<link rel="feed" type="application/atom+xml"
      href="/feed/summaries" title="Article Summaries">

It also means that you do not need to specify the type attribute to have the link recognised as a syndication feed and browsers can still show it in the subscription list.

<link rel="feed" href="/feed" title="Articles">

Another benefit of this is that if there is ever a new syndication feed format, you don’t have to wait for browsers to be updated with the new MIME type to recognise it as a feed. For instance, if your feed reader supports the hAtom microformat, you could subscribe to an HTML document that has been linked to as a feed.

<link rel="feed" type="text/html"
      href="/feed.html" title="All comments">

In order to retain backwards compatibility, the definition for alternate says that when used in combination with a type attribute with the value of either application/rss+xml or application/atom+xml.then it implies the feed keyword as well.

The feed keyword can also be used in combination with alternate to say that it is specifically the feed for the current document.

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

However, it’s important not to confuse this with the way alternate stylesheets works. The behaviour of rel="alternate stylesheet" is a special case where the use of alternate doesn’t mean an alternate representation of the document itself. In fact, if when used together with stylesheet, that is the one case where the type value cannot imply the feed value.

<link rel="alternate stylesheet" type="application/atom+xml"
      href="/feed.atom" title="This is not a feed!">

Mozilla already has bugs filed for implementing the new feed relationship and fixing its bug with with rel="alternate stylesheet" which are planned for inclusion in Firefox 3.0.

Posted in Browsers, Elements | 16 Comments »