Typically, the channel link points to an HTML webpage, not the RSS url as seems to be hard-coded by the views_rss module.

It would be nice to allow the channel link to be customized to any desired path, via a text field on the views edit page.

It would also be useful if, by default, it pointed to the "page" view rather than the rss view (perhaps auto-generated by stripping off "/feed" from the end of the view path).

CommentFileSizeAuthor
#3 views_rss_channel_link.patch752 bytesmfb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scafmac’s picture

I would say this is a bug more than a feature request. At least the link to a feed instead of a link to the view page is a bug. Luckily, there is a simple fix. On or around line 102 of views_rss.module, change:

  $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,
  );

to:

  $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->url, NULL, NULL, true),
    'description' => $view->description,
  );

The important part is that $view->real_url is changed to $view->url on the fourth line.

Also I do not agree that it is a good solution to add a field to point to any random page. Primarily because that is a bandaid for the problem. What other text fields will folks clamor for?

I'm just shooting from the hip here, but I believe the real problem is that there is no good way to override channel tags or add additional ones. A better solution might be to change the theme_views_rss_feed() function to call hook_nodeapi for the channel as well as each individual episode. This would allow a module to implement hook_nodeapi and overwrite the default tags, but more importantly to me, it allows to add any number of missing channel tags.

Any thoughts?

merlinofchaos’s picture

scafmac:

Your general analysis is correct, but your actual solution fails if a view has other non-feed arguments.

The greatest example is the taxonomy view -- each taxonomy should have its own feed. That requires it to respect the taxonomy argument.

Right now, when placing the feed icon, Views constructs a version of the URL that has the 'feed' argument added. The fix for this basically requires doing the opposite; i.e, constructiong a version of the URL that has the 'feed' argument removed from the list.

This isn't that hard, but I have not had anything like free time for working on this in several weeks.

mfb’s picture

Status: Active » Needs review
FileSize
752 bytes

Here's a simple patch for modifying the view URL as described.

Btw, my implementation had some "weird" requirements (syndication server); I ended up having to add a "channel link" field to the view edit page via form_alter.

merlinofchaos’s picture

Status: Needs review » Fixed

I fixed this the 'right' way; as well, I allowed the channel description to be set via the 'option' field of the argument. Twofer! Fixed in both 4.7 and 5

Anonymous’s picture

Status: Fixed » Closed (fixed)