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!
Comment | File | Size | Author |
---|---|---|---|
#24 | aggregator_rss_0.patch | 4.77 KB | Uwe Hermann |
#22 | aggregator_rss.patch | 4.72 KB | Uwe Hermann |
#20 | aggregator_feed.patch | 4.79 KB | Uwe Hermann |
#18 | aggregator.module.bundle-feeds.patch.txt | 4.53 KB | sillygwailo |
#5 | aggregator.module_3.patch | 4.47 KB | blake7-1 |
Comments
Comment #1
blake7-1 CreditAttribution: blake7-1 commentedFixed the navigation menu problems mentioned above. Please consider this patch instead of the first one.
Comment #2
drummWhen this functionality is added it should be able to generate feeds for each aggregator category as well.
Comment #3
blake7-1 CreditAttribution: blake7-1 commentedDone. The attached patch supports RSS feeds of each aggregator category through the XML icon at the bottom exactly like the main aggregator page.
Comment #4
Dries CreditAttribution: Dries commented1.
$base_url . "/aggregator" . $url
is incorrect. All URLs must be constructed usingurl()
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.
Comment #5
blake7-1 CreditAttribution: blake7-1 commented1. Using
url()
now.2. Added the presistent variable
aggregator_rss_limit
which controls how many RSS items are generated. Aform_select
edit control to control the new variable, withall
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.
Comment #6
Boris Mann CreditAttribution: Boris Mann commented+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).
Comment #7
blake7-1 CreditAttribution: blake7-1 commentedNow 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.
Comment #8
Dries CreditAttribution: Dries commentedI'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:
It is certainly not a requirement, just a thought that might be worth considering.
Comment #9
Dries CreditAttribution: Dries commentedI'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:
It is certainly not a requirement, just a thought that might be worth considering.
Comment #10
Bèr Kessels CreditAttribution: Bèr Kessels commentedcross linking to a [feature] that talks about such a unified rss link: http://drupal.org/node/11937
Comment #11
sethcohn CreditAttribution: sethcohn commentedBump.
Neat feature, would be nice for 4.6
What's the progress on making it happen?
Comment #12
Boris Mann CreditAttribution: Boris Mann commentedHere'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)
Comment #13
Bèr Kessels CreditAttribution: Bèr Kessels commentedA request for unification of feeds is waiting in the queue already.
Comment #14
Boris Mann CreditAttribution: Boris Mann commentedThis 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.
Comment #15
playdreamer CreditAttribution: playdreamer commentedThrilled 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'.
Comment #16
Dries CreditAttribution: Dries commentedIn addition to the other suggestions, this patch should not use arg() and should make the hardcoded string stranslatable.
Comment #17
deskpops CreditAttribution: deskpops commentedI'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
Comment #18
sillygwailoThe 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.
Comment #19
Michael Acord@www.simplemoneymanagement.info CreditAttribution: Michael Acord@www.simplemoneymanagement.info commentedAny idea how to get this to apply to drupal 4.6.1? The first chunk does not patch, but chunks 2-4 do.
Comment #20
Uwe Hermann CreditAttribution: Uwe Hermann commentedHere's an update for the patch from #18, rerolled for current HEAD. Please test.
Comment #21
Dries CreditAttribution: Dries commentedThis 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.
Comment #22
Uwe Hermann CreditAttribution: Uwe Hermann commentedUpdated 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.
Comment #23
Dries CreditAttribution: Dries commentedStill 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.
Comment #24
Uwe Hermann CreditAttribution: Uwe Hermann commentedOK, updated.
Comment #25
drummLets go with 2.0, like the other feeds.
Comment #26
LAs4n CreditAttribution: LAs4n commentedIs this patch implemented?
Moving to cvs.
Comment #27
mustafau CreditAttribution: mustafau commentedThis was implemented.
Comment #28
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.