If you have a view with more then one Feed Display, each with a different Path in the Feed settings, the channel link will always be the Path of the first Feed Display.

For example; I have 2 Feed Displays with the following paths:

  • blog/category1/rss
  • blog/category2/rss

The output of the first Feed display would be something like:

<channel>
    <title>Category 1 Blog</title>
    <link>http://www.example.com/blog/category1/rss</link>
    ....
</channel>

The second Feed display would be something like:

<channel>
    <title>Category 2 Blog</title>
    <link>http://www.example.com/blog/category1/rss</link>
    ....
</channel>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Charles Belov’s picture

For that matter, the generated channel link contains the first path, whether that path is from a page or an RSS feed. If the feeds are preceded by a page display, the link contains the URL of that page.

Per the RSS 2.0 specs for required channel fields, link is supposed to be "The URL to the HTML website corresponding to the channel." So the URL of the feed itself is not an appropriate URL for the channel link. But only the person programming the view would know whether the first page display having a path is an appropriate link value for the channel link.

Therefore, an RSS display requires two path fields: the path of the RSS display (currently specifiable) and the path of the channel link (currently assumed and therefore possibly wrong, with no way to specify the correct channel link path).

So this bug report would better specify the need to add a channel link path for each RSS display and to never assume what that path is.

uq’s picture

If we want to fix the RSS feed to get the correct url of the feed, we need to change:
$link_display_id = $view->display_handler->get_link_display();
to:
$link_display_id = $view->display_handler->view->current_display;

However I agree to above comment and think we should follow the RSS standard. Therefore I created a patch to fetch the site front page url for the channel link field.

uq’s picture

Status: Active » Needs review
Chris Matthews’s picture

Version: 7.x-3.5 » 7.x-3.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 2 year old patch in #2 to theme.inc does not apply to the latest views 7.x-3.x-dev.

Checking patch theme/theme.inc...
error: while searching for:
  }
  $vars['title'] = check_plain($title);

  // Figure out which display which has a path we're using for this feed. If there isn't
  // one, use the global $base_url
  $link_display_id = $view->display_handler->get_link_display();
  if ($link_display_id && !empty($view->display[$link_display_id])) {
    $path = $view->display[$link_display_id]->handler->get_path();
  }

  if ($path) {
    $path = $view->get_url(NULL, $path);
    $url_options = array('absolute' => TRUE);
    if (!empty($view->exposed_raw_input)) {
      $url_options['query'] = $view->exposed_raw_input;
    }

    // Compare the link to the default home page; if it's the default home page, just use $base_url.
    if ($path == variable_get('site_frontpage', 'node')) {
      $path = '';
    }

    $vars['link'] = check_url(url($path, $url_options));
  }

  $vars['langcode'] = check_plain($language->language);
  $vars['namespaces'] = drupal_attributes($style->namespaces);

error: patch failed: theme/theme.inc:885
error: theme/theme.inc: patch does not apply
Andrew Answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.35 KB

Patch rerolled.