Fixing Relative Links In Entries
Occasionally I hear from someone who finds the links in my entries are broken in their feed reader, especially if they are reading a syndicated version of my entries.
The reason is that I have relative links which are not being made absolute by the reader (or syndication code).
Many readers (such as Google Reader) treat relative links as being relative to the feed itself, so /blog/ gets converted to http://jtauber.com/blog/. But even if the reader does, this, that doesn't help with syndicated entries unless the syndicator does some processing. Some do but others don't.
There's nothing wrong with relative links in Atom content, but if you use them you really should have an xml:base attribute to help a reader deal with them properly. I've now updated all my entries to include an xml:base. I'll see how many planets and other syndications pass that through when placed on the entry. I wonder if the content element would be better.
In the process of making the change, though, I noticed my entry/link[@rel="alternative"] were also relative which is, I suspect, a no no. So I've made them absolute as well.
I'm going to do a little bit more experimentation, but things should work now. I may still have goofed up somewhere but I'm fairly confident now that if links are broken then it's either a bad reader or bad syndication involved. Either way, please let me know in a comment below if you encounter any problems here on in.
UPDATE 1: The atom feed of the unofficial planet python doesn't pass through the xml:base but it doesn't need to as it has made all links absolute (and was doing so before my change)
UPDATE 2: I'm afraid that Advogato's syndication is just plain broken. In their RSS 2.0 feed (why not provide Atom!?), they make content links absolute but they do so by treating them relative to www.advogato.org !! My only suggestion is to just avoid Advogato syndication all together. I'm tempted to turn it off.
Comments (3)
James Tauber on Nov. 17, 2008:
Damjam, well relative links in content are definitely allowed. Whether the link element should use them is another matter, although my feed passed feedvalidator.org before the changes mentioned in the post.
Tim on Nov. 18, 2008:
Your feed now works with iGoogle. I was having trouble before.
Last Modified: Nov. 17, 2008
Author: James Tauber
Damjan on Nov. 17, 2008:
AFAIK, once when I was dealing with my atom feed and testing it with the atom validator, the validator said relative links are not by the standards.
That was some time ago though.