Option to disable feeds in header and implement block with links to comment rss feeds

teradome - September 17, 2007 - 16:27
Project:Comment RSS
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

hey there.

so the links for comment rss feeds are listed first in the $head of the pages they are inserted into

for most bots, the first link is assumed to be the content feed for that page, so when users add a site to an rss service (e.g., AideRSS) the comments feed becomes the main, indexed feed for that site.

comment rss feeds should be listed after the drupal content rss link

#1

nickistre - September 21, 2007 - 16:40

I got hit by this in with Technorati picking up my comments instead of my posts on my site. I'll see if I can poke around over the weekend and create a quick patch.

#2

nickistre - September 24, 2007 - 00:11

I figured that this would be pretty complex to fix. It's my first time really looking at Drupal's code, so I'm pretty much learning how it works at the same time.

For now, this is what I've discovered while stepping through the code:

It looks like the function to call to setup rss feeds is drupal_add_feed() in includes/common.inc. This function itself calls drupal_add_link(), which then finally calls drupal_set_html_head() (both in the same file) to insert the rss links into the a static variable that will eventually used as the header.

The main front-page RSS feed is inserted into the header in the function node_page_default() in the file modules/node/node.module.

The commentrss feeds are inserted into the header in the function commentrss_menu() in commentrss.module.

The unfortunate thing is that commentrss_menu() is called before node_page_default(), causing the comment rss feeds to be inserted before the main feed, causing the comments to be autodetected first.

There's no way that I can see where modifying the theme will be able to fix this.

I currently see two possible plans of action:

  1. Modify the drupal_add_feed(), drupal_add_link(), and drupal_set_html_head() to allow for "weighting" of header code, so commentrss_menu() can force the comment rss feeds to output after the main feeds. This will require modifications of the core drupal code, which would probably be more difficult to get accomplished (though this may be useful for other modules, too),
  2. Somehow cause commentrss_menu() to be called after node_page_default(). I am investigating this option, but I have little idea of where to go with this.

Hopefully, I will be able to develop a solution as I study the code, but feel free to add suggestions if you think of any.

#3

nickistre - October 5, 2007 - 03:55

I had just thought of a third probably even better solution than the other two: Give an option to disable the comment rss links in the header, but provide a block with the links. I'll try to get to making a patch for this over the weekend, as I get some time.

#4

nickistre - October 10, 2007 - 06:42
Title:comment rss feeds are first in auto-discovery before content rss, becomes default» Option to disable feeds in header and implement block with links to comment rss feeds
Status:active» needs review

The patch adds a new option under admin/content/commentrss which lets the admin choose whether to have the links to the feeds be added to the header or not. It also implements a block that will contain the links to the RSS feeds.

Turning off the add feeds to header option and placing the available block some where will get around the issue of the comment feeds coming before the front page RSS feeds, while still providing the comment rss feeds in the block.

AttachmentSize
commentrss-block.patch 4.09 KB

#5

gnassar - December 1, 2007 - 19:33

Could this be fixed with the module weight module, setting Comment RSS to have a lower weight than Node?

If that doesn't work, I'd say this is a good thing to submit as a feature fix to core. It potentially affects every module that tries to add a feed.

#6

sethcohn - December 4, 2008 - 17:13

FYI, no, a weight change (higher or lower than node) to Comment RSS does NOT fix this.

 
 

Drupal is a registered trademark of Dries Buytaert.