Jul 14 2009

Adding and styling an RSS feed to a view in Drupal

Published by Justin at 9:03 am under Drupal, Programming

Here is how you add an RSS feed to a Drupal 6 page that is powered by a view:

  1. Edit your view
  2. Add a display called “Feed”
  3. Specify a path for the RSS, like /rss

Drupal should automatically add the RSS auto-discovery link to your site, but often this doesn’t happen. You can add this manually by editing the page.tpl.php file in your theme and following these directions.

If you want to customize the theme it gets a bit more tricky. You can add new files to your theme folder to customize the RSS feed:

  1. Edit your view
  2. Click on the feed display
  3. Click on the “Theme Information” link

The first file lets you alter the RSS wrapper around your RSS content, and the second file lets you alter the style of each item in the feed. However, you don’t really have any additional information about your node, so you can’t add CCK fields or other information.

Nota bene: If you add either file be sure to click the “Rescan folder” icon, otherwise Drupal won’t see the file.

There is a great post over at TIMtheToon that has a great function you can add to your theme to add the full $node data to your RSS template file.

Nota bene: Don’t forget to reset the theme registry to Drupal detects changes to your theme file.

One response so far

One Response to “Adding and styling an RSS feed to a view in Drupal”

  1. Rob Featureon 18 Feb 2010 at 10:20 am

    Orrrrr…you can just use Display Suite module and life is easy and beautiful :) It lets you create a ton of different display styles for RSS which you can use in your views.

Trackback URI | Comments RSS

Leave a Reply