Creating an RSS feed Using the Views Module in Drupal Content Management System

Creating an RSS feed Using the Views Module in Drupal Content Management System
Page content

RSS News Feeds in Drupal

One of the most important features of modern web sites is the ability to provide a summary of key information as an RSS (Really Simple Syndication_)_ feed. These can be accessed by a growing number of modern browsers, eg Firefox 2.0 onwards, Internet Explorer 7.0 onwards, as well as news readers programmes and the Thunderbird email client. You can even read them on mobile phones. So if you want to be taken seriously in today’s web 2.0 world, you need your own RSS news feed!

How To Generate Your Own RSS Feed In Drupal Using the View Module

rss1

By default Drupal automatically creates a feed for the whole website. But you can generate your own RSS feed In Drupal using the Views module to create a bespoke view If you don’t know how to do this, then you need to read my previous article in this series (Part 3). Once you have created a query, you can create an rss feed from it.

The website www.alangillies.com provides RSS feeds to allow direct access to its news items from a remote browser or news reader.

1. Create the RSS view

a. In the 1st column, select ‘Feed’ in the drop-down menu, and click Add Display.

b. Under Basic Settings in the 2nd column, click Row style:Missing style plugin

c. In the options that appear below the Views Interface, under Feed: How should each row in this view be styled, tick Node, then Update

This loads the next options menu- Display type:

d. Select “Use default RSS settings”, click Update.

2. Set the path for accessing your feed

a. In the 2nd column under Feed settings, click Path: None

b. Enter the path. The www.alangillies.com site uses news/rss.xml as an argument feeds/%/rss.xml

Click Update

You may also wish to set other options differently from the default, or from the page view. For example, the default number of items to be shown is 10, but this can be set independently for the RSS feed.

3. Sort to show most recent at top of feed

a. Scroll up to Sort criteria in the right most column and click the + icon.

b. In the Groups drop-down menu below, select ‘Node’, then check Node: Post date, and click Add.

c. Select Descending Sort order. Click Update.

4. Set filters to hide unpublished entries

a. Click the + icon next to Filters.

b. In the options below, select Node under Groups drop-down menu, choose the Node: Published filter, and click Add.

c. Check the box Published. Click Update default display

5. Save your RSS feed

Click Save

At my own www.alangillies.com site, a page was created with the links to the various RSS feeds. This allows the feeds to be tested. It also provides a facility for web site visitors to readily select the feeds they wish to access. I have added a link to my Brighthub articles on the same page for a full list go to https://www.brighthub.com/members/profacgillies/articles.aspx.

views3

Conclusions

Within Drupal, the Views module provides an easier way to write queries than PHP programming, and the getting started guide does a good job of guiding the inexperienced user. The facility to output this query as a feed provides the ability to generate RSS feeds for syndication.

This post is part of the series: Drupal

Drupal is a powerful open source content management system. This series of articles reviews its usability for an intermediate user with no prior knowledge of PHP and MySQL developing on a Vista running PC and a third party server.

  1. How to Install Drupal
  2. Using the Views Module in Drupal
  3. How To Generate Your Own RSS Feed In Drupal Using the View Module