If you create Views RSS the <link> element in the RSS channel incorrectly points to the location of the feed and not to the HTML source of the content (generally the home page of the site).
Here is the beginning of the current main RSS feed:

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;rss version="2.0" xml:base="http://www.teachenglishinasia.net" xmlns:dc="http://purl.org/dc/elements/1.1/"&gt;
&lt;channel&gt;
 &lt;title&gt;Teach English in Asia | TEFL, ESL, ELT, TESOL, Japan, Korea, China, Asia&lt;/title&gt;
 &lt;link&gt;http://www.teachenglishinasia.net/allcontent/rss.xml&lt;/link&gt;

This is a serious problem when pinging blog search engines because they then send visitors to your RSS feed and not your home page. I think it's a critical problem, but want to make sure it's not a bug on my end before marking it "critical".

You can view the problem here:
http://www.teachenglishinasia.net/allcontent/rss.xml

Comments

merlinofchaos’s picture

Are you sure this is a Views generated RSS feed? Typically, Views rss feeds include the word 'feed' at the end, not 'rss.xml'.

Z2222’s picture

Are you sure this is a Views generated RSS feed? Typically, Views rss feeds include the word 'feed' at the end, not 'rss.xml'.

It's a custom URL alias.

I aliased it because all URLs ending with "feed" are blocked with robots.txt.

Z2222’s picture

Is anyone else having this problem? The RSS feed is telling blog search engines to send people to the wrong page on my site -- to the RSS feed instead of to an actual page.

catch’s picture

//I aliased it because all URLs ending with "feed" are blocked with robots.txt.

If you want those to show, why not remove those statements from robots.txt?

merlinofchaos’s picture

Can you export the view? I've not heard of this happening lately (it used to, but that was fixed several versions ago).

xjm’s picture

I can confirm this is happening in Views 1.5 (not sure whether that counts as "several versions ago"). In all my Views-generated RSS feeds, the <link> tag for the channel contains the feed URL rather than a URL for the view. Here's the relevant code snippet in views_rss.module

/**
 * plugin that actually displays an RSS feed
 */
function theme_views_rss_feed($view, $nodes, $type) {
  if ($type == 'block') {
    return;
  }
  global $base_url;

  $channel = array(
    // a check_plain isn't required on these because format_rss_channel
    // already does this.
    'title'       => views_get_title($view, 'page'),
    'link'        => url($view->real_url, NULL, NULL, true),
    'description' => $view->description,
  );

$view->real_url is set in views.module

$view->real_url = views_get_url($view, $args);
/**
 * Figure out what the URL of the view we're currently looking at is.
 */
function views_get_url($view, $args) {
  $url = $view->url;

  if (!empty($url)) {
    $where = 1;
    foreach ($args as $arg) {
      // This odd construct prevents us from strposing once there is no
      // longer an $arg to replace.
      if ($where && $where = strpos($url, '$arg')) {
        $url = substr_replace($url, $arg, $where, 4);
      }
      else {
        $url .= "/$arg";
      }
    }
  }

  return $url;
}

I checked the source for version 1.6 and the critical bit of code in views_rss.module has been corrected to remove the feed "argument" from the URL. So, the OP might want to double-check the version of views. I'm going to install 1.6 on a dev site when I get the chance and confirm whether it resolves the issue for me.

Z2222’s picture

//I aliased it because all URLs ending with "feed" are blocked with robots.txt.

If you want those to show, why not remove those statements from robots.txt?

I don't want any of the feeds that have URLs that end with /feed to be crawled. I aliased the views feed so that it is not blocked by robots.txt.

catch’s picture

Status: Active » Postponed (maintainer needs more info)

Rather than an alias, you should probably use a page view with the rss style, with the actual url you want - especially if it's just for that one feed. Please give that a try and post back

merlinofchaos’s picture

I requested an export of the view.

Snippets of code from version 1.5 are of no value; there were 5 beta releases and a 1.6 release after that.

Z2222’s picture

Rather than an alias, you should probably use a page view with the rss style, with the actual url you want - especially if it's just for that one feed. Please give that a try and post back

I'm not sure what you mean. That is the URL that I want (/allcontent/rss.xml). My situation requires an alias for the feed.

xjm’s picture

The point of the snippets from 1.5 was to illustrate for the OP why the version made a difference for this particular issue.

Guitarmiami,

The reason you are being asked to test your feed with the default /feed URL is to determine whether the alias is causing your problem. Views expects feed URLs to have that feed argument in them. Consider this function in 1.6 that tries to correct views feed URLs:

/**
 * feed argument hook that will convert us to RSS or display an icon.
 * the 4th argument isn't part of the hook, but we use it to differentiate
 * when called as a hook or when called manually from views_rss_views_post_view
 */
function views_rss_views_feed_argument($op, &$view, $arg, $argdata = NULL) {
  if ($op == 'argument' && $arg == 'feed') {
    $view->page_type = 'views_rss';

    if ($argdata['options']) {
      $view->description = $argdata['options'];
    }

    // reset the 'real url' to the URL without the feed argument.
    $view_args = array();
    $max = count($view->args);
    foreach ($view->args as $id => $view_arg) {
      ++$count;
      if ($view_arg == $arg && $view->argument[$id]['id'] == $argdata['id']) {
        if ($count != $max) {
          $view_args[] = $argdata['wildcard'];
        }
      }
      else {
        $view_args[] = $view_arg;
      }
    }
    $view->feed_url = views_get_url($view, $view_args);
  }
  else if ($op == 'post_view' && $view->build_type != 'block') {
    $args = views_post_view_make_args($view, $arg, 'feed');
    $url = views_get_url($view, $args);
    $title = views_get_title($view, 'page', $args);

    if ($view->used_filters) {
      $filters = drupal_query_string_encode($view->used_filters);
    }

    drupal_add_feed(url($url, $filters), $title);
  }
}

Since views is specifically looking for the feed argument in the function above, it could be that your /allcontent/rss.xml alias is preventing this function from doing its job. So, by disabling the alias as a troubleshooting step, you can determine whether the issue is internal to Views, or whether it is a result of the interaction between your alias and Views.

Posting an export of your View will also help the module maintainers test your issue and, possibly, help resolve it.

whalebeach’s picture

I just found that we can manipulate the $view->feed_url value in Argument Handling Code field in view settings page.
This value will be set between link tag in the RSS feed which is generated by views_rss.module.

sun’s picture

Status: Postponed (maintainer needs more info) » Fixed

Based on merlinofchaos' comments, this issue won't fix, because no one attached an export of a 1.6 based view.
Based on xjm's comment, this issue should be fixed in 1.6.

Feel free to re-open this issue, but please update to 1.6 first and ensure that this issue still exists.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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