The attached patch adds support for generating an RSS 0.92 feed of the default news aggregator page (the output of aggregator_page_last()). This allows re-use of the Drupal aggregator in other RSS readers like Trillian.

The patch consists of the aggregator_page_rss() function which builds the XML output needed. It uses the existing RSS building functions already present to construct the feed.

Note the comment about how many items are in the feed. In Drupal 4.4.x, there was a variable "aggregator_page_limit" which represented how many items were returned for both the HTML and RSS versions. It defaulted to 75 items. In Drupal CVS, all the HTML output is now paged through a hard-coded limit of 20 items per page. A limit of 20 seems small for the RSS feed, so I reverted to the old limit of 75. Would it be better to add a new variable like "aggregator_rss_limit"?

Also, there are 2 places that the callback to aggregator_page_rss are installed. One is in _aggregator_page_list right before the pager output and shows up as the XML icon (like how the OPML feeds are linked now). The other is in aggregator_menu where I try and install a menu itme called "RSS feed". For some reason, the menu itme is not displaying itself though I believe I am inserting it properly.

Feel free to contact me if there are any questions. Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

blake7-1’s picture

FileSize
2.54 KB

Fixed the navigation menu problems mentioned above. Please consider this patch instead of the first one.

drumm’s picture

When this functionality is added it should be able to generate feeds for each aggregator category as well.

blake7-1’s picture

FileSize
3.25 KB

Done. The attached patch supports RSS feeds of each aggregator category through the XML icon at the bottom exactly like the main aggregator page.

Dries’s picture

1. $base_url . "/aggregator" . $url is incorrect. All URLs must be constructed using url() as it is aware of clean URLs and path aliasing.

2. Emitting 75 RSS items is quite much (uncommon) and can easily turn into a bandwidth bottleneck. Can we add one global setting that controls how many entries our feed should have (not just the newly introduced feeds)? To 'export' your content in case you wish to migrate to another tool, a special value 'all' (say '1000000') might be handy.

blake7-1’s picture

FileSize
4.47 KB

1. Using url() now.

2. Added the presistent variable aggregator_rss_limit which controls how many RSS items are generated. A form_select edit control to control the new variable, with all defined as 1000000, was added to the configure tab.

I am not sure what you mean by "our feeds" versus "newly introduced feeds" in your comment.

Also, even though the code-freeze has taken place, do you think it would be possible to get this into Drupal 4.5? The code change is very minimal and I believe the ability to share aggregated feeds is a great feature.

Boris Mann’s picture

+1

I actually assumed (there was much discussion?) that the re-exporting of aggregator items on a per-bundle basis was going to be enabled for 4.5.

Let's get this in before the code freeze -- this would be a major feature announcement for 4.5, and could perform the basis for other great functionality for 4.6 (e.g. per category OPML file generation).

blake7-1’s picture

Now that 4.5 has released. Can this go into CVS/HEAD? Is there any other changes to the patch that need to be made by me to make that happen?

Thanks.

Dries’s picture

I'll look at it again. Does the patch add XML-icons or how do people find out about the RSS feeds? Can't we make the URLs a bit more intuitive? For example by making it so that you merely have to append '/rss.xml' to the aggregator module's URLs:

foo.com/aggregator/rss.xml
foo.com/aggregator/categories/1/rss.xml

It is certainly not a requirement, just a thought that might be worth considering.

Dries’s picture

I'll look at it again. Does the patch add XML-icons or how do people find out about the RSS feeds? Can't we make the URLs a bit more intuitive? For example by making it so that you merely have to append '/rss.xml' to the aggregator module's URLs:

foo.com/aggregator/rss.xml
foo.com/aggregator/categories/1/rss.xml

It is certainly not a requirement, just a thought that might be worth considering.

Bèr Kessels’s picture

cross linking to a [feature] that talks about such a unified rss link: http://drupal.org/node/11937

sethcohn’s picture

Bump.

Neat feature, would be nice for 4.6

What's the progress on making it happen?

Boris Mann’s picture

Here's another bump to this. I would say since it missed 4.5 (and was ready at the time) we get this in to 4.6.

Should mesh nicely with walkah's RSS updates.

Dries: there is an XML icon at the bottom of each category page, plus the HTML header can include an alternate link to the feed. I vote against any sort of "rss.xml", people can alias if they wish.

(ideally we could get per-category OPML links as well, but I'll leave that for another feature request)

Bèr Kessels’s picture

A request for unification of feeds is waiting in the queue already.

Boris Mann’s picture

This patch is not about "feed unification", it adds RSS feeds for category bundles...which have been asked about (and coded for, here in this patch) since 4.4.

playdreamer’s picture

Thrilled I found this as its the one killer feature that the aggregator appeared to be missing. One point I notice though is that the title of the generated feed is 'drupal', when presumably it should pick up something along the lines of 'sitename news aggregator'.

Dries’s picture

In addition to the other suggestions, this patch should not use arg() and should make the hardcoded string stranslatable.

deskpops’s picture

Category: feature » support

I'm trying to integrate Blake7's RSS creation code into my aggregator.module, but I don't think I have the experience to do it properly. Has anyone created a complete aggregator.module that has this already in it that I can just use to replace my current aggregator module? (I'm running 4.5.2)

Thanks in advance,
Jeff

sillygwailo’s picture

Category: support » feature
FileSize
4.53 KB

The attached patch adds a bugfix in the title (changes it from a hard-coded 'drupal' to a variable_get('site_name', 'drupal') and makes the link element inside the channel a fully-qualifed URL using base_url + '/' then the path of the aggregator. (It doesn't incorporate, however, Dries suggestions for removing the args and translating the hard-coded strings.) This patch is based on the above patches.

Suggestions for future patches: +1 on Dries' suggestions, and add a link element in the HTML header for RSS autodiscovery.

Michael Acord@www.simplemoneymanagement.info’s picture

Any idea how to get this to apply to drupal 4.6.1? The first chunk does not patch, but chunks 2-4 do.

Uwe Hermann’s picture

Status: Active » Needs review
FileSize
4.79 KB

Here's an update for the patch from #18, rerolled for current HEAD. Please test.

Dries’s picture

Status: Needs review » Needs work

This patch needs some love:

- Use %d and %s directives in SQL queries.

- Remove the RSS items configuration option. We don't have such setting for node feeds either so this looks unbalanced. It would be nice to have some global RSS feed settings though, to control how many items are syndicated, whether descriptions are to be provided, etc.

- The strings can not be translated.

Uwe Hermann’s picture

Status: Needs work » Needs review
FileSize
4.72 KB

Updated patch for HEAD. Hardcodes the number of feed items to 15 (as with the normal Drupal feed) for now, I'll create another patch which introduces site-wide feed customization options later. SQL queries use %d and %s now. Replaced " with ' where possible.

Dries’s picture

Status: Needs review » Needs work

Still not good enough:

- That t(' for ') needs to be fixed ... translators won't be able to do anything with it. They won't spot the spaces either. At the very least make it '%foo for %bar' or something, or just change the code so there is nothing to translate.

- $item->title . t(' [').$item->ftitle.t(']') is hairy; impossible to translate and ugly to look at in your aggregator. I'd go with just $item->title.

- . The leading space in t(' aggregator') needs fixing too ...

- t('Drupal aggregator RSS feed') . $title is plain wrong: no space between feed and $title. Joe Average doesn't and shouldn't know what Drupal is.

Uwe Hermann’s picture

Assigned: Unassigned » Uwe Hermann
Status: Needs work » Needs review
FileSize
4.77 KB

OK, updated.

drumm’s picture

Title: Add support for generating an RSS 0.92 feed of news aggregator items » Add support for generating an RSS 2.0 feed of news aggregator items
Status: Needs review » Needs work

Lets go with 2.0, like the other feeds.

LAs4n’s picture

Version: x.y.z » 7.x-dev

Is this patch implemented?

Moving to cvs.

mustafau’s picture

Status: Needs work » Fixed

This was implemented.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.