Hi,
I have a view with 2 page displays (blog, and blog/) and 1 feed display (feed/blog). I am attaching the feed to both the displays.
The page_2 display (blog/) accepts a contextual filter for year, and will show a list of blogs filtered by the given year.
The rss icon for page_1 (blog) links to 'feed/blog', which is correct. The rss icon for page_2 (blog/2011), however, shows 'feed/blog/2011', which is incorrect, as my feed does not have a contextual filter.
Though the feed on feed/blog/2011 does show the same content as feed/blog, for SEO purposes, they should ideally use the same url if they have the same content.
I have created a patch to take into account whether the feed display supports arguments, and if it does, the arguments will be added to the path (as it currently does), if not, the arguments will be excluded from the path.
Hope this helps.
Cheers,
Victoria
Comment | File | Size | Author |
---|---|---|---|
#7 | views-1278760-rss-arguments.patch | 734 bytes | ygerasimov |
#5 | views-feed-contextual-filters-1278760.patch | 943 bytes | jamix |
#4 | views-feed-contextual-filters-1278760.patch | 942 bytes | jamix |
#1 | 1278760-rss-icon-link.patch.1.txt | 926 bytes | victoriachan |
Comments
Comment #1
victoriachan CreditAttribution: victoriachan commentedAttaching patch. It is only a few lines:
Comment #2
dawehnerIt's probably better to use either $view->argument or $view->get_items because $this->display->display_options might have problems with overriden values etc.
Comment #3
jamix CreditAttribution: jamix commented#1 works great here, thanks.
@dawehner: $this->view seems to be holding the object for the display the feed is being attached to, which makes relying on $this->view->argument not work.
Comment #4
jamix CreditAttribution: jamix commentedRe-rolling patch from #1 to fix PHP notice when there are no contextual filters defined in the view at all.
Comment #5
jamix CreditAttribution: jamix commentedAttaching the correct patch file for #4.
Comment #6
MKorostoff CreditAttribution: MKorostoff commentedThanks
Comment #7
ygerasimov CreditAttribution: ygerasimov commentedRerolled #5 patch without trailing spaces.
Comment #8
jos_s CreditAttribution: jos_s commented#7 worked for me. Would be nice if this patch could now be included in Views. Or is anything stopping this?
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commented#7 worked for me well, using Views 7.x-3.13 and Drupal 7.42.
This patch is really useful - nobody wants people to subscribe to a feed with last year's blog entries, news etc. Like jos_s (#8) I'd be very happy to see the patch included in Views.
Comment #11
ron_s CreditAttribution: ron_s commentedTraditionally, Views RSS and Date iCal feeds work by inheriting the contextual filters from the Views displays to which they are attached. There may not be any filters on existing feeds, and patch #7 will break feeds that have paths such as "/calendar/%/rss.xml" and no filter.
Something needs to be included in the patch to notify developers that existing feeds may stop working. There also needs to be coordination with patches for Views RSS (https://www.drupal.org/node/1722348) and Date iCal (https://www.drupal.org/node/2791847).
As well, I understand the issue being recognized, but have the implications of no longer inheriting contextual filters for feeds been fully thought through? Thanks.
Comment #12
riddhi.addweb CreditAttribution: riddhi.addweb at AddWeb Solution Pvt. Ltd. commented