Problem/Motivation

Summary

When creating an RSS feed display and submitting it for validation to the w3c validator, the latter makes a recommendation that should be implemented - https://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html

Steps to reproduce

  1. Enable views & views_ui
  2. Go to admin/structure/views/add, create a view with a Feed display with Format: RSS Feed, assign it a title and a path and make it accessible to anonymous users (see this screenshot)
  3. Save the view
  4. Go to http://validator.w3.org/feed/
  5. Under 'Validate by URI' tab, enter the URL of the feed

Expected result

  • The RSS feed validates without complaining

Actual result

Proposed resolution

Patch suggested in #5 (this can be tested on https://simplytest.me/ for instance).
When validating the view with the patch, the W3C validator does not complain (see this screenshot).

Original report by jvieille

I am trying to subscribe a LinkedIngroup to the rss feeds from a Drupal web site.
This feed is generated by my frontpage view.

No items are collected from linkedIn, and I am suspecting some strict validation control by LinkedIn
Feed validator says that the RSS feed is valid, but reports errors
http://validator.w3.org/feed/
the feed address is http://web2.see.asso.fr/rss.xml

- "description should not contain relative URL references"
- "Use of unknown namespace: http://drupal.org/group/og"
- "style attribute contains potentially dangerous content: white-space: pre;"
- "Invalid HTML: EOF in middle of construct"
- Missing atom:link with rel="self"

Thanks for help

Issue fork drupal-1337894

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

simone.girlanda’s picture

I got the same problem, my rss feed is produced using a views.

I've validated it and I got just this warning:

- Missing atom:link with rel="self"

linkedin do not publish my feed.

How can I add this reference in my feed ?

This is my feed: http://www.datacheck.it/news/feed

to jvieille: I think that you have to change your feed content to eliminate all other issues.

kars-t’s picture

Status: Active » Fixed

Hi

I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.

Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

alexmcl’s picture

Version: 6.x-2.9 » 6.x-2.16
Status: Closed (fixed) » Active

I get the same problems with LinkedIn groups rejecting RSS feeds from my site. Specifically, http://validator.w3.org/feed gives:

description should not contain relative URL references

Missing atom:link with rel="self"

My feed is http://www.indigoblue.co.uk/rss/tag/nfp

I could not see any reference to this being fixed in Views 6.x-3

fengtan’s picture

Version: 6.x-2.16 » 7.x-3.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.72 KB

Updating issue description and attaching a patch suggestion.

annya’s picture

Status: Needs review » Reviewed & tested by the community

- Missing atom:link with rel="self"

It is fixed by patch in #5 by Fengtan(Thank you!). I confirm that it works as it should.

Anonymous’s picture

This patch was applied before the release date of Views 7.x-3.11.

The issue still occurs with that version.

Could somebody confirm whether or not this patch was pushed through in that version?

fengtan’s picture

@freddi the patch is not included in views-7.x-3.11 -- at the moment it is pending the review of a Views maintainer

deja711’s picture

Any progress?

fengtan’s picture

Attaching screenshots so it is easier for people to understand the issue and the solution.

fengtan’s picture

Issue summary: View changes
fengtan’s picture

dawehner’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 8.0.x-dev
Component: feed displays » views.module
Category: Support request » Bug report
Status: Reviewed & tested by the community » Patch (to be ported)

Seems reasonable, thank you!

fengtan’s picture

I tried to port the patch to Drupal 8 - see file attached.
It is not quite working yet since the <atom:link> tag gets auto-escaped in the Twig template, and also the way of rendering the tag (#markup) could be improved, but maybe this can help.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joco_sp’s picture

Is there any news for D8?

catch’s picture

Status: Patch (to be ported) » Needs work

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

plato1123’s picture

Do Drupal RSS feeds not validate? Using Drupal 8.3.7:

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

line 2, column 0: Use of unknown namespace: http://ogp.me/ns# [help]

line 2, column 0: Use of unknown namespace: http://schema.org/ [help]

line 2, column 0: Use of unknown namespace: http://rdfs.org/sioc/ns# [help]

line 2, column 0: Use of unknown namespace: http://rdfs.org/sioc/types# [help]

line 2, column 0: Use of unknown namespace: http://www.w3.org/2004/02/skos/core# [help]

line 2, column 0: Use of unknown namespace: http://www.w3.org/2001/XMLSchema# [help]

Not sure if same issue but I find RSS feeders don't see the feed on the page, don't auto detect it but some will see it if we paste the link in, others will not. Frustrating. We replaced an old wordpress site where RSS readers would find the feed easily.

omegadela’s picture

Status: Needs work » Needs review
StatusFileSize
new964 bytes

As of Drupal 8.3.7 patching RSS.php with :

  /**
   * Return an array of additional XHTML elements to add to the channel.
   *
   * @return array
   *   A render array.
   */
  protected function getChannelElements() {
    $url = $this->view->getUrl()->setAbsolute()->toString();
    return [
      [
        'namespace' => ['xmlns:atom' => 'http://www.w3.org/2005/Atom'],
        '#type' => 'html_tag',
        '#tag' => 'atom:link',
        '#attributes' => [
          'href' => $url,
          'rel' => 'self',
          'type' => 'application/rss+xml',
        ],
      ],
    ];
  }

Allow the RSS to validate aigainst the atom:link warning.

(Patch attached for 8.5.x)

Status: Needs review » Needs work
omegadela’s picture

Status: Needs work » Needs review
StatusFileSize
new1.42 KB

Fixing test failings by removing the namespace from the element after parsing.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

ronaldmulero’s picture

#25 fixes missing atom link for me.

Thank you omegadela!

Drupal core 8.9.2

jungle’s picture

Version: 8.9.x-dev » 9.1.x-dev
Status: Needs review » Needs work
Issue tags: +Needs tests

Would be great to have test coverage. 9.1.x is the current dev branch.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

robpowell’s picture

I applied this patch in 9.3.3. After refreshing and exporting my xml, the xml validator broke saying something was wrong. Unfortunately I couldn't debug further.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

neclimdul’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Here's a simple test.

Mixed feelings on the implementation.

Pro:

  • Works on existing sites with modified templates

Con:

  • Every other field like this in core is in the template
  • Since it works with existing templates it might add duplicates for sites already adding it
neclimdul’s picture

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ericgsmith’s picture

StatusFileSize
new3.17 KB
new2.21 KB

Reroll against 10.1.x (automerge / no conflicts)

jedihe’s picture

#39 applies cleanly on top of 9.5.0.

bserem’s picture

Indeed it also applies to 9.5.2 whereas #37 does not apply to 9.5.2

lendude’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/src/Plugin/views/style/Rss.php
@@ -88,7 +88,19 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
+    $url = $this->view->getUrl()->setAbsolute()->toString();

Are we sure this is always going to return the correct path? Is the display always set to the RSS display when we reach this point or can we get a page display or a fatal error here?

Also, I agree with #36, is this the best way to fix this? This could lead to the same element being there multiple times. It might be the best way, but having some validation for this route over changing the template would be good.

kazah’s picture

Still errors of unknown namespaces...

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

lendude’s picture

The IS is still talking about D7 and contrib View, where it looks like this has actually been addressed, so could somebody update the IS to make it more current? I'm assuming this is still an issue

nicxvan’s picture

Aside from the issue summary update, there is a fix here for the cdata that is out in 11.0 and 10.4 #3433: Use CDATA in XML RSS Feeds.

The core rss feed should be generated on that version and run through a validator to identify any remaining issues.

ericgsmith’s picture

Title: Views RSS feeds have validation issues » Views RSS feeds have a validation recommendation
Issue summary: View changes
ericgsmith’s picture

Have tested on 11.x and it still producing the same recommendation. Updated the issue summary steps to remove reference to drupal 7 and use terminology in the current views UI - also tweaked to title to clarify this is a recommendation not an error.

ericgsmith’s picture

Moved the existing patch to an MR.

Tested again and Len's comment is #42 is correct - this patch causes an error when following the steps to reproduce. Once you add the new view and before saving it the preview will through an exception as we are trying to get a route for a view that does not exist.

Once the view is saved the validation recommendation is resolved - leaving as "Needs work" as the approach to resolve the issue does not have consensus.

ammar_ar’s picture

StatusFileSize
new3.29 KB

reroll the patch against 10.4.1

neclimdul changed the visibility of the branch drupal-1337894-1337894-views-rss-feeds to hidden.

neclimdul’s picture

Status: Needs work » Needs review

Worked around the creation failure with a quick check.

Would have expected _something_ to have been there but I guess not. Otherwise I would expect the view to be populated so we wouldn't get an empty URL in normal usage.

smustgrave’s picture

Status: Needs review » Needs work

Appears to have phpstan issue, also could use a rebase

If you are another contributor eager to jump in, please allow the previous poster(s) at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

ericgsmith’s picture

Fix in #53 doesn't fix the error.

PHPStan is correct, view is always present here - this issue is when toString is called on the URL object and it goes through the route handler - it is here a route not found exception is thrown that Route "view.foo.feed_1" does not exist.. This is applicable for both a new view and adding a new display to a view.

First thought was that we can do Url::fromUserInput('/' . $this->view->getPath())->setAbsolute()->toString(); which does return the correct path when the view is not saved - but then I noticed in views UI its actually saying "Path: This display has no path." above the preview.

Looking at https://git.drupalcode.org/project/drupal/-/blob/main/core/modules/views... it checks using hasUrl which catches that exception.

This means that the preview shows based on the saved route - but it keeps in consistent with the UI.

ericgsmith’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new549 bytes

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

smustgrave’s picture

Status: Needs work » Needs review

Think the bot was wrong on this one.

smustgrave’s picture

Status: Needs review » Needs work

This one feels super close, left 1 comment on the MR