One feed module to rule them all
I found the build in feed support of Drupal to be a bit poor. It only offers RSS feeds, publishes only teasers, but not full text and doesn't allow to set an image for your feed. Atom support is missing and there is no comment feed. There are modules for both atom and comment feed, though.
That's why I decided to write a module for general feed handling purposes. The module is still very beta, however, it already powers this site's feeds. You can download it here. Be sure to read the INSTALL.txt file, since this module requires a hack to the node module.
These features are currently supported:
- Feed image for RSS feeds
- Both full text and teaser are published
- Atom 1.0 feeds by just appending /atom to every feed (except taxonomy feeds). For example: /node/feed/atom gives the Atom 1.0 feed for new content.
- Comment feeds for every node that has commenting enabled. These are located under node/[id]/feed and node/[id]/feed/atom
- Handles If-modified-since requests to minimize bandwith even if caching is disabled
- Turns relative links into absolute
To gain my totalfeeds module control over Drupal's build in feeds, the fucntion node_feed in the file node.module mut be changed. Just add four lines of code to the beginning of the function, so it looks like this:
<?php function node_feed($nodes = 0, $channel = array()) { // The following lines are to be added if (function_exists("totalfeeds_feed")) { totalfeeds_feed($nodes, $channel); return; } // End of totalfeeds hack .. original code follows ... ?>
The module is based upon my brain dead simple feed writer class.
Update: Version 0.2 has been uploaded. It checks data before writing it to the feed and adds three more options:
- Define number of items in main and comment feed
- Decide if either all nodes are included in main feed or only nodes promoted to front page
- Change default type to either RSS or Atom for all feeds
Additionally, the width and height of image now must be entered.
Update: Version 0.3 has been uploaded. It adds missing translations and some bugfixes.
Update, September 7th, 2006: The module has been updated for Drupal 4.7. Additionally, two patches provided by Daniel Ellison have been incorporated. The module now supports feeds for all comments, and the dc:creator tag. You can download it here. The version for Drupal 4.6 is still available here.
Comment by Jeff
November 8, 2005 - 17:37
I tried out this module - it looks good - but I started to see some errors in the logs. Probably around node privacy. Here's some samples:
Location /node/22/feed
Message You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0 query: select max(timestamp) as created from comments where nid = '22' WHERE (na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0','node_privacy_byrole_role1','node_privacy_byrole_user0')) in /var/www/therailfan/includes/database.mysql.inc on line 66.
Location /node/feed
Message Unknown table 'na' in where clause query: select max(changed) as changed, max(created) as created from node WHERE (na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0','node_privacy_byrole_role1','node_privacy_byrole_user0')) in /var/www/therailfan/includes/database.mysql.inc on line 66.