Creating an RSS feed using the Views module in the Drupal Content Management System
RSS
 View all Hubs
See what's in...

Drupal: Open Source Content Management part 4: Generating a bespoke RSS feed

Part 4 of 4 in the series: Drupal
4
Review of Drupal as a generator of RSS feeds
by Profacgillies (4,591 pts )
Published on Oct 10, 2008
RSS feeds are becoming increasingly important as a way of communicating content. They can be read by modern browsers as well as dedicated news reader programmes. Drupal provides the Views module to query the content of the database and generate bespoke RSS feeds.
298 views
go to: part 1

Introduction

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.

Creating a RSS feed

By default Drupal automatically creates a feed for the whole website.

Alternatively, you can create a feed with specific information. For this you need to create a bespoke view using the Views module. 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 Opinion pieces 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 opinions/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

In the www.alangillies.com application, 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.

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.

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.

Bright Hub - Science & Technology Articles, Buyer's Guides, How-To Tips and Software Reviews
About Bright Hub | Contact Us | Terms of Use | Privacy Policy | Copyright Policy | ©2008 Bright Hub Inc. All rights reserved. Page copy protected against web site content infringement by Copyscape