The WHATWG Blog

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

Feed Autodiscovery

by Lachlan Hunt in Browsers, Elements

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.

16 Responses to “Feed Autodiscovery”

  1. Ian Bicking says:

    If a page supported hAtom, could this be valid: <link rel=”feed” href=””> ? I.e., a page is its own feed.

  2. Lachlan Hunt says:

    Ian, that would be unnecessary, since the browser can already detect the hAtom markup in the page and offer to subscribe to it. It would just need to be implemented.

  3. [...] The WHATWG Blog has announced the addition of a new link type in HTML5 for linking to feeds (rel=”feed”). The post notes that this can make auto-discovery easier and also makes linking to hAtom feeds tidier. [...]

  4. [...] The WHATWG Blog » Blog Archive » Feed Autodiscovery “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.” Independent evolution, check! (tags: atom autodiscovery rest web) [...]

  5. Aukcje says:

    And again feed discovery only talks about LINK elements, not A elements. Everybody already has an orange XML button, with an A link pointing to the feed. Why not just add the rel and type attributes to that element.

  6. Meble says:

    Aukcje: how to make a difference between you linking to a feed you are subscribed to, and the feed for the page you are on? rel=”alternate” in the context of a body-element and rel=”alternate” in head-context seem to have different purpose to me. Aukcje

  7. Frank says:

    The WHATWG Blog has announced the addition of a new link type in HTML5 for linking to feeds (rel=”feed”). The post notes that this can make auto-discovery easier and also makes linking to hAtom feeds tidier.

  8. porneL says:

    Ian, that would be unnecessary, since the browser can already detect the hAtom markup in the page and offer to subscribe to it. It would just need to be implemented.

    I’d suggest specyfing self-referencing <link> anyway, since browser may not support hAtom, but user may have external application that does.

  9. JubJ says:

    Fuck! Feed is rel=”index” (& media for rss, atom or html index), for what new value?

  10. Aristo says:

    it doesnt seem to be work, i ve activate all plug ins in my software

  11. fee says:

    WHATWG Blog has announced the addition of a new link type in HTML5 for linking to feeds (rel=”feed”). The post notes that this can make auto-discovery easier and also makes linking to hAtom feeds tidier

  12. Ian, that would be unnecessary, since the browser can already detect the hAtom markup in the page and offer to subscribe to it..

  13. John Lee says:

    And again feed discovery only talks about LINK elements not A elements. Everybody already has an orange XML button with an A link pointing to the feed. Why not just add the rel and type attributes to that element…

  14. Curling says:

    Nice information.
    And how long ago was ‘nofollow’ tag implemented? As I remeber it was the first of such kind ‘tags’. But I may be wrong
    And where may I find information on all these link types?

  15. ceviri says:

    Ian, that would be unnecessary, since the browser can already detect the hAtom markup in the page and offer to subscribe to it. It would just need to be implemented. Her yere dadanmayın

  16. Rene furterer says:

    The post notes that this can make auto-discovery easier and also makes linking to hAtom feeds tidier.
    Why not just add the rel and type attributes to that element.