Since more than half of the visitors to MacMegasite read the RSS feed, I’ve decided to take advantage of it by putting ads in the feed, using FeedBurner. Since FeedBurner doesn’t modify the original feed but creates a new modified feed, I needed a way to get ads in my existing feed. One way to do it is by adding a redirect for the RSS file.
Since Drupal uses a dynamically generated feed, that isn’t so easy. I figured out a simple work-around with a small patch to node.php. My patch creates a private feed URL and redirects /node/feed to the FeedBurner feed. Here’s how to do it:
Find the function node_page() in modules/node.module and look for the switch statement which dispatches the command. You’ll see the following lines:
case 'feed': node_feed(); return;
Change it to
case 'something_random_here': node_feed(); return; case 'feed': header("Location: http://feeds.feedburner.com/macmegasite"); return;
Use some random value for the command which will invoke node_feed() and use that only as feedburner’s source. Now your private URL is used to access the actual RSS feed and /node/feed will be redirected to feedburner’s modified feed.