dionidium.com

Wayne Burkett's Weblog | Home

Atom's Link Element: The Type Attribute and Content Negotiation
09:59PM CST December 31, 2003

When we first announced our Atom 0.3 feed we complained that we weren't sure which media type to specify within the type attribute of link elements pointing to documents served using content negotiation. In our case, some browsers get archived documents served as application/xhtml+xml; others get text/html. Two media types. One type attribute. Which should we use?

Dare Obasanjo forwarded our question to the Atom-Syntax mailing list (where we probably should have asked it in the first place).

Eric Scheid's solution:

<link rel="alternate" type="text/html" href="http://www.example.com/" />
<link rel="alternate" type="application/xhtml+xml" href="http://www.example.com/" />

That is: the same href in both, the same @rel, but different @types.

Sam Ruby explains:

With conneg, you can find multiple media types in the same location. Stating that xhtml can be found at a given URI does not imply that one can not find other representations at the same location.

What a link tag says is literally "you can find THIS media type THERE". This means that it would be quite valid to have multiple link statements with the same URI.

Eric, again:

In a perfect world the type attribute would be passed to whatever is being asked to retrieve the resource, and it would specify that type in it's http request as to what type of resource it wants back (ie. content negotiation).