Relative links in RSS and Atom

The upcoming 1.3 version of NewsGator fully supports relative links. I’m writing this here to make sure I haven’t missed anything…input is appreciated. 1.3 beta testers – what is written here does not reflect your latest code.

When resolving all links, including <link> and similar elements, and content links (description, content:encoded, atom:content), xml:base behavior is used. The xml:base attribute may appear anywhere in the input document, and the rules will be followed according to the spec. Which means, of course, that multiple xml:base attributes can be used, applying to different parts of the document.

For content elements, in the case where no applicable xml:base is found, links will be resolved relative to the <link> URI (or <guid> if @isPermaLink=”true”).

8 thoughts on “Relative links in RSS and Atom

  1. Greg Reinacker

    Sam, that’s true…however, for the majority of feeds out there that are (arguably incorrectly) using relative links without a xml:base, basing URI’s off of the post link gives us typically better results. This is due to the way most tools generate their posts and feeds, and where relatively-linked stuff actually gets placed…

    So it’s a tough call. Technically correct per the spec, or more likely to function with actual data in the wild. I tend toward the latter…

    Reply
  2. Eric

    Greg,

    Maybe I am missing something since I have not played with RSS yet, but could you not do a quick check, and see if the relative path is “from” the URI (maybe check for the existence of a specified image), and then if that doesn’t yield the desired results, default to the current method?

    Eric

    Reply
  3. Eric

    Here is a “neat feature”… if after you “post” a comment, you hit the refresh button in IE, the post will get posted again.

    Eric

    Reply
  4. Greg Reinacker

    Well, I could do something like that, except 1) it’s a resource drain, and 2) I still wouldn’t be guaranteed of getting the correct link. Just because there’s something at the URL doesn’t mean it’s the right thing…

    Honestly, I think this will shake out over the next few months as relative URL’s are more widely accepted, and guidelines for their use are more widely published.

    And you’re right about the “feature” – haven’t got around to fixing that yet!

    Reply
  5. Sam Ruby

    Guessing may turn out to be the right thing to do for RSS feeds, but my problem is that different tools will implement different heuristics impeeding interoperability.

    In any case, my experience is that relative links are fairly rare in RSS feeds. The RSS validator flags such usages in html with a warning.

    As for Atom feeds, I’ll try to make sure that there are conformance tests for aggregators that include various combinations of relative urls, with and without xml:base.

    Reply

Leave a Reply