Without getting into the why I am executing a view twice. I noticed that it caused duplicate RSS feed links to be added to a page's header.
The problem is that the views_plugin_style_rss() plugin is calling drupal_add_link() instead of drupal_add_feed(). Using drupal_add_feed() prevents duplicate link from being created and drupal_add_link() does not.
Below is the current code in views/plugins/views_plugin_style_rss.inc - LINE 34 for views-6.x.2.x
$this->view->feed_icon .= theme('feed_icon', $url, $title);
drupal_add_link(array(
'rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => $title,
'href' => $url
));
The change would simply be
$this->view->feed_icon .= theme('feed_icon', $url, $title);
drupal_add_feed($url, $title);
This change could also be applied to views-6.x.3.x and views-7.x-3x.
Hope this make sense. Anyway it is nice to post a suggestion that simplifies code (vs creating more).
Thanks,
~jake
Comments
Comment #1
iamjon commentedassigning to dereine for review
Comment #2
merlinofchaos commentedThere was a reason we aren't using drupal_add_feed, though I don't remember what that reason was now.
Comment #3
dawehnerAfaik the problem with drupal_add_feed is that there is always an rss icon added to the bottom of the page.
Comment #4
mustanggb commented