Hi,

I have a Feed display with arguments setup like this (the key thing is the action here):

Path: feeds/rss/tags
Attached to: Page (the other display in the view, whose path is /tags)
Arguments: Taxonomy:Term ; Action if argument is not present: Hide view / Page not found (404)

If I visit the URL "/tags", I get a list of the tags available with a summary of nodes that are marked with those tags (as expected, that's how the page view is setup, does not really matter here), but I also get the feed icon at the bottom of the page plus an alternate link in the code (
) which also displays in Firefox's address bar. So that means the feed is being attached to the page.

If I use one of those links (the feed icon in the page or the address bar) I get a 404 page.

I would expect the Views module to hide the links beforehand and not providing a link which is useless in its nature.

I'm not sure whether to consider this a "bug" per se or just a feature request. I configured an attachment to the same page, and if I set it up as the feed (hide view/404), it will not show up in the page. I could understand an attachment is not a feed, but basically I see both the same: they attach to the page.

So, the basic question would be ... Would it be possible for Views to check if a Feed is configured as "hide if no arguments are present" and if so, just do not attach to the page?

PS: I tried to work around this setting up two different pages and attaching the feed to one of them and using a little trick (configuring one of the views with a path of "tags/%" in order to force it to have an argument, but that (a) gives me a star "*" in the breadcrumb trails, (b) is quite painful to setup and (c) I think that is a bit of a(n) ugly hack.

This should be quite simple to understand, but please let me know if you want me to show the view here.

Comments

frames’s picture

Oops!

I just noticed I forgot to add the code tags above to show the HTML source in Firefox. Shouldn't be giving a lot of info, but here is go for clarity sake:

<link rel="alternate" type="application/rss+xml" title="Feed RSS" href="/feeds/rss/tags" />

Sorry about that.

dawehner’s picture

Status: Active » Fixed

so this is fixed, i think

merlinofchaos’s picture

Status: Fixed » Active

No, don't think so. It's kind of a weird situation actually.

The easiest workaround is probably multiple page displays, one with the path 'tags' and the other with 'tags/%' and the RSS feed only attaches to that page. I say this because the logic of detecting necessary arguments when attaching the feed URL is quite difficult and I'm not sure it's worth doing with a relatively easy workaround available.

Still, leaving open to ponder.

john bickar’s picture

FWIW, you can override this on a case-by-case basis by placing the following function in your theme's template.php:

function mytheme_feed_icon($url, $title) {
  if ($image = theme('image', 'misc/feed.png', t('Syndicate content'), $title)) {
    if (preg_match('/\/path\/to\/my\/view\/feed/', $url)) {
      $url = preg_replace('/feed\/.*$/', 'feed', $url);
    }
    return '<a href="'. check_url($url) .'" class="feed-icon">'. $image .'</a>';
  }
}

(Replace 'mytheme' with your theme's name and 'path/to/my/view' with the path to your View.)

esmerel’s picture

Status: Active » Postponed
merlinofchaos’s picture

Status: Postponed » Closed (won't fix)

I think solution in #3 is best.