8
votes

I am trying to create a dead simple rss feed. I validate my rss using this service form w3.org. Here is what my feed looks like:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>example.com RSS</title>
        <link>https://www.example.com/</link>
        <description>A cool website</description>
        <item>
            <title>Cool Article</title>
            <link>https://www.example.com/cool-article</link>
            <guid>https://www.example.com/cool-article</guid>
            <pubDate>Sun, 10 Dec 2017 05:00:00 GMT</pubDate>
            <description>My cool article description</description>
        </item>
    </channel>
</rss>

but I get this error from the feed validator:

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

line 14, column 4: Missing atom:link with rel="self" [help]

So I click on [help] and get this:

If you haven't already done so, declare the Atom namespace at the top of your feed, thus:

Then insert a atom:link to your feed in the channel section. Below is an example to get you started. Be sure to replace the value of the href attribute with the URL of your feed.

<atom:link href="http://dallas.example.com/rss.xml" rel="self" type="application/rss+xml" />

Okay, first off I was trying to validate rss, not Atom but they seem to be trying to steer me in the direction of Atom. Okay, I'll try it anyhow.

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>example.com RSS</title>
        <link>https://www.example.com/</link>
        <description>A cool website</description>
        <atom:link href="http://www.example.com/rss.xml" rel="self" type="application/rss+xml" />
        <item>
            <title>Cool Article</title>
            <link>https://www.example.com/cool-article</link>
            <guid>https://www.example.com/cool-article</guid>
            <pubDate>Sun, 10 Dec 2017 05:00:00 GMT</pubDate>
            <description>My cool article description</description>
        </item>
    </channel>
</rss>

Validate that and it gives you this error:

Self reference doesn't match document location [help]

So I click on [help] and get this:

Check the document referenced by the href attribute. If it is not the intended feed, correct it.

This may not be a problem. At the current time, the feedvalidator does not probe to assess equivalence of documents.

And that's where I'm stuck. They don't say how to get it to do that. Do I get it to do that by reading the atom specification and reimplementing my feed as Atom? Because I am not going to do that.

4

4 Answers

3
votes

As the message says the feed is valid. So you can proceed without making any changes to the feed. None of my feeds have that link and they work perfectly well. The message is very old and not accurate.

4
votes

You don't have to turn your feed from RSS to Atom to support atom:link.

To fix the problem, in the atom:link element, change the value of the href attribute to the URL of your RSS feed. So if your RSS feed is at http://dallas.example.com/rss.xml, the atom:link element should be this:

<atom:link href="http://dallas.example.com/rss.xml" rel="self" 
type="application/rss+xml" />

Including an atom:link element in your RSS feed makes it more portable and easier to cache. For more details, visit the RSS Best Practices Profile.

2
votes

The validator is often wrong or confusing. I was generating an Atom document recently and attempted to check with that tool, it started to advice me about missing tags from RSS... Get rid of the atom:link tag that was suggested by the tool, it's for Atom document not RSS. I would just double check with RSS specification instead of using the tool.

Self reference doesn't match document location [help]

It's probably checking against Atom specification again. Even if it was a valid Atom document, if you were pasting the xml content into the tool, you will get that message. It checks whether whether the 'self' link in atom is same as the location the atom document is being served from.

1
votes

There are great answers here already, and I'd guess that Dave Winer's answer is authoritative, but for those of us who'd like to eliminate validation errors wherever possible…

This is likely a case of mismatched scheme - in this example, the feed was likely requested at https://www.example.com/rss.xml, but atom:link specifies that the feed is to be found at http://www.example.com/rss.xml.

Note http vs https:

<link>https://www.example.com/</link>
<atom:link href="http://www.example.com/rss.xml" rel="self" type="application/rss+xml" />