Feedvalidator.org reports this warning when validating a Drupal site's RSS feed:
Missing atom:link with rel="self"
The explanation says that the channel section requires an atom link to the feed, and also the Atom namespace declaration.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | rss-atom-D6.patch | 1.6 KB | jhl.verona |
| #6 | rss-atom-D6.patch | 1.78 KB | jhl.verona |
| #1 | atom_rss.patch | 1.51 KB | mgifford |
Comments
Comment #1
mgiffordI got the same thing with Drupal 7. Decided it was time to figure out why and resolve the problem. Just added a atom name space.
Related links:
http://www.rssboard.org/rss-profile-1#namespace-elements-atom-link
http://validator.w3.org/feed/docs/howto/declare_namespaces.html
http://wordpress.org/support/topic/144264?replies=11
Comment #2
dave reidIt's worth noting this is just a recommendation, not a warning.
See http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fdrupal.org
Comment #3
mgiffordVery true, but it's annoying and it looks bad. Why not just fix it up properly by adding full support for the atom name space?
Especially since wordpress seems to already be supporting the following name spaces in their rss feeds:
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
Comment #5
mgiffordThink the 9 exceptions are just changes to the simpletest definitions... Could be wrong though.
Comment #6
jhl.verona commentedThe original patch by mgifford has an error: the modification to
format_rss_channeluses$base_urlbut fails to declare it as aglobal. Also (same function) I changed the default URL for$self_filefrom'rss.xml'to'/rss.xml'Unfortunately I don't have a Drupal 7 codebase, so I am attaching a patch against Drupal 6.17. This has been 'tested' on the Drupal Italia forums, here http://www.drupalitalia.org/node/10879 (which is why I've set 'reviewed and tested by the community), in particular by Giovanni Di Giovanni on his web site: http://giovanninews.com/taxonomy/term/7/0/feed for example, which gives http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fgiovanninews.com%2Ft...
Many thanks to mgifford for the original patch, I hope he can use this to repatch Drupal 7.
John
Comment #7
dave reidThis needs to be fixed in D7 first, then backported if necessary. That's just the way this works, so please don't change the version again.
Why can't we use $_GET['q'] instead?
Other functions use format_rss_channel and will need to have the xmlns:atom added to their tag output in order to validate.
See http://api.drupal.org/api/function/theme_aggregator_page_rss/7
Arrays longer than 80 characters should have each element on a new line.
66 critical left. Go review some!
Comment #8
jhl.verona commentedMy apologies.
Perhaps mgifford can reply as to why he used
$_SERVER['REQUEST_URI'], though thinking about it, even the test (and hence local variable$self_file) seems superfluous to me.Ah -
theme_aggregator_page_rss(). Excellent observation - I see what you mean. Obviously this can be patched as well, but unfortunately, theformat_rss_channel()function is used by a great many contributed modules, and each or all of them can be setting their ownrsselement.At this point, as far as Drupal core is concerned, IMHO it would make sense to add a
format_rss_body()function so that there is only one way of creating thersselement. Though this is not essential, just a "nice to have".Fortunately,
format_rss_channel()provides anargsparameter, which doesn't seem to be used by any contributed module (in Drupal 6.x, doing a quick grep, and no, I'm not prepared to bet money on it). This is, it would appear, the 'correct' way of adding additional elements to the channel, so the problem can be circumvented by adding the element, not informat_rss_channel(), but innode_feed()itself. The RSS board does not seem to specify exactly where theatom:linkelement should be placed (http://www.rssboard.org/rss-profile) just thatitemelements come last.So the patch could be something like:
I have again attached a patch, as always for Drupal 6.17 (sorry), and I'm not going anywhere near the 'Edit issue settings' panel ;-)
HTH
John
Comment #9
jhl.verona commentedTrying to kick in the automatic test for the patch, sorry.
It's just not my day today - I forgot this is Drupal 7 development. my apologies...
Comment #10
venusrising commentedAnyone in #8 get this working test this? I see it si for 6 which is what we want we were just not sure if it is ready for testing? Please let us know
Comment #11
herve commentedsubscribe.
No plan to apply a patch for D7 and D6 about this problem of atom:link?
Regards,
herve.
Comment #12
herve commentedAt the moment, you should add atom:link attribute in that way
Comment #13
venusrising commented@hereve can you explain where this # 12 code would be added to? Thanks for your help
Comment #14
nig commentedCould anyone explain where to put the #12 code? I have built my RSS feed with Views module and I can't see anywhere in Views where this could go.
Thanks
Comment #15
nig commentedin case anyone else is struggling with this....
I ended up using the Views RSS module
Comment #16
GasmanDesign commentedI'm trying to add this to my Drupal 6 RSS feed because I keep getting this error: Add missing atom:link with rel="self" to RSS feeds.
I noticed this code is at the top of D7 RSS feeds in the Channel.
What's the easiest way to add the "atom:link" to my RSS channel in Drupal 6?
Where does the PHP code from #12 (herve) go? Into the index.php file?
I tried installing the Views RSS module and adding it with views, but I can't seem to get the fields to show up.
Any info would be great.
The project: My client developed a Wordpress mobile app and has a Druapl 6 website. They are trying to use their RSS feeds to pull in News to their new app.
Comment #17
jp.stacey commentedFor reference, this seems to be fixed in Views.
I'd implemented my own workaround for this unfixed issue using
hook_preprocess_views_view_rss()some time ago, on my Planet Drupal feed. This uses Views, not core I'd not made any changes recently, but just today, the feed was reported as no longer passing RSS validation: https://www.drupal.org/node/2468977#comment-10719336This was because the
xmlns:atomattribute was being added twice. In effect, my own fix had become a duplication instead. Here's the fix to Views, included as part of 7.x-3.12 in November: #1337894: Views RSS feeds have a validation recommendationSo one workaround in the absence of a fix would be to use Views for the site's RSS. Not ideal, but an option.
Comment #18
neclimdulNewer issue jp mentioned captures current state better and has more recent(hah!) activity so cleaning this up.
Comment #19
papagrande