Once again, Scott Andrew is unhappy about the “requirement”† in RSS that you use absolute URLs (scottandrew.com/main/contact/ rather than /main/contact/). He asks:
why can’t RSS readers resolve relative URLs like browsers do? I am after all required to include a base URL in the LINK element of my RSS feed.
However, the <channel> <link> element is not at all required to be the base URL for relative links. It isn’t defined as a base URL, just as “The URL to which an HTML rendering of the channel title will link, commonly the parent site’s home or news page.” (RSS 1.0) or “The URL to the HTML website corresponding to the channel.” (RSS 2.0). In a weblog, typically the link will be usable as a base URL, but unless both specs make it clear that it must be, some people using relative URLs will assume that readers will do the right thing, and resolve relative URLs as relative to the URL where the page was retrieved, meaning that
images/one.jpg should be resolved as
The problem gets worse with non-weblog feeds, though. There’s no guarantee that there is an HTML page where all the items in a feed appear, so it may not be possible to give a single URL in the link which is the base URL: an “all our news” feed might include items from a half-dozen subdomains, a couple of different domains, and include items (“this RSS feed is changing to support <xhtml:body>, if your reader doesn’t support that switch to this other URL”) which don’t appear in an HTML page anywhere. In fact, some feeds (picture something like a feed of server statistics, or baseball scores) don’t have an associated HTML page at all.
It would be technically possible for both specs to define how relative URLs should be formed and resolved, but it simply isn’t going to happen: RSS 2.0 is frozen, and RSS 1.0 is, ah, stalled, shall we say, and there are so many people associated with it who think that the <description> element should never ever be anything but plain text that I can guarantee that any proposal for a change in the spec to define how relative URLs should be resolve would devolve into yet another argument about that, instead.
Fortunately, for his problem, we don’t need to change two specs and the behavior of every RSS reader in existence. Thanks to my tireless harrassment of programmers much sharper than me the last time he had a problem with relative URLs and RSS (the trail led through Sam Ruby to David Rayners and finally to Alexei Kosut), now there’s MTResolveURLs, a plugin that adds a resolve_urls global filter which can be applied to any MT tag to resolve any relative URLs using your MT site URL as a base. Drop it in your plugins directory, add
resolve_urls="1" to any tags in your RSS templates that might include relative URLs, and move on to more important battles.
† Strictly speaking, it should be a warning rather than an error, since neither fork of the specification actually mentions anything either way about URLs in <description> or <content:encoded>