Published on

How to Add an RSS Feed to a Drupal Website

In This Article

I recently went through the process of setting up an RSS Feed for our blog here at DevCollaborative so that our articles can be syndicated to Planet Drupal. It had a surprising amount of gotchas and the documentation was dated and sparse. So I thought I’d help remedy that by sharing what I learned.

I’ve created a video that walks you through the steps of using Views to set up an RSS feed on your Drupal site, below. I’ve also written out the steps below. 

Remote video URL

RSS Isn’t Dead, Dangit

For those who might not be familiar with RSS feeds, RSS (Really Simple Syndication) is an open web standard that lets websites generate a syndicated content feed to which people can subscribe. In recent years, corporate social media platforms have worked to overshadow RSS by pushing their own content feeds, but it is still a widely-used and helpful way to get content to audiences. Adding an RSS feed to your site is a great way to participate directly in preserving and defending the open web.

If you’re still not convinced it’s worthwhile, I suggest you read the thought-provoking blog post, Why I Still Use RSS, and how it helped the author to improve their focus and wellbeing during the pandemic. If you are a marketer, I recommend Is RSS Dead? 23 Million Sites Still Find It Useful. So What’s Going On?. If you yourself are not yet using an RSS Reader (or need to get back on the bandwagon), then check out How to Read RSS in 2020.

Surprise! You Already Have an RSS Feed

Drupal actually comes with two RSS feeds out of the box, and you probably have at least one of them running on your site. Congratulations on already having an RSS feed. :) That’s the good news. The bad news is that these default RSS feeds are a little messy. To get a clean output that ensures your content displays nicely in RSS Readers, I recommend following the steps below in Create a Views RSS Feed Display

Frontpage Feed

The first RSS feed Drupal gives us is the Frontpage feed. RSS feeds are powered by the Views module.

Check to see if you are using the Frontpage View by visiting the Views admin page at /admin/structure/views.

If you see it in the list of enabled Views then you’ve got yourself a Frontpage Feed at your-site-url.com/rss.xml.

The Frontpage Feed view configuration page is at /admin/structure/views/view/frontpage/edit/feed_1.

Image
Screenshot of the Frontpage Drupal Views configuration page.
Drupal comes with two RSS feeds out of the box. This is the configuration page for the Frontpage RSS Feed Views display.

The Frontpage feed is configured to show all posts that have been marked Promote to your front page.

Taxonomy Term Feed

The other feed Drupal provides is one for each taxonomy term on your site. That means that depending on your site, you may have dozens or more feeds to which your audience can subscribe. If you have a taxonomy term for Baby Elephants, then you have an RSS feed for all those people eager to see the next cute baby elephant photo you publish to your site.

Image
Screenshot of the Taxonomy Term Feed Views Display configuration page.
Drupal provides, by default, an RSS feed for each taxonomy term on the website.

You can then decide whether to customize these existing feeds, disable them for now, or delete the Feed display altogether. If you want to keep any of them, do read on because there are some important adjustments you will need to  make. 

Create a Views RSS Feed Display

More often than not, your feed will be associated with an existing page. For example, you may have a News page showing published articles and want a corresponding feed. In that case, navigate to the Views overview page Structure > Views (admin/structure/views) and edit the View that is powering that page.

Note: If you would like to cut right to the chase, import this News Article configuration file and News View configuration file to see the final work of art.

Add a Feed Display

Once you are editing the correct View, click Add > Feed.

Image
Screenshot of Views configuration page adding a new Views display.


Define the Channel Information

Let’s start by defining the general information about the feed, also known as the channel.

Image
Screenshot of Feeds Views display information settings.


Set the Title of the View to whatever you want the RSS Feed title to be. Remember, if this is your single feed of all relevant content on your site, it should be the website’s name.

Next, define the channel description in Format: Settings.

Image
Screenshot of the RSS Feed description setting.


Define the Feed Link

The link to your feed is defined by the Path under Feed Settings. The default link for the Frontpage feed is /rss.xml. That works, but know that you don’t need the path to end in .xml. You can set this to whatever you want. For example, it could be /feed.

If you plan on having multiple feeds, then I recommend you set up a Feeds webpage that then lists out each feed link, similar to what A List Apart does with their RSS page

If you would like to display an RSS icon that links to this feed on a corresponding page, then set the Attach to option to that display.

Configure Fields to Display

By default, the Format on the Frontpage Feed is set to show Content of RSS

This means that we are showing fields from the RSS view mode. If you click into that select list you see a list of other available view modes, several of which are non-existent.

Unfortunately, this default setting is very broken. 

Image
Screenshot of the default RSS settings that don't work.


Speaking of broken features, there is also an RSS Publishing configuration page (/admin/config/services/rss-publishing). This too is very broken and should be ignored entirely. 

Image
Screenshot of the Drupal RSS Configuration page, which should be ignored.


There is progress being made for both of these issues, which you can follow along at: 

This is fine. Everything is fine. We didn’t want that RSS Publishing configuration page anyways. We want fine-grained control over our feed. We want a View that shows fields.

Go ahead and change Show: Content to Show: Fields 

When you do this, you won’t be able to click the Apply button, because we do not have any fields to associate with the required RSS Feed properties. This is fine. Everything is fine. Click the upper right X to close the form.

 

Image
Screenshot of field settings of RSS Feed Views display.


Now we need to add fields for the following RSS settings:

  • Title
  • Link
  • Description
  • Creator
  • Publication date
  • GUID field (unique content ID)

Notice the setting is not for Author, but rather for Creator. This is because the Author requires an email address. That is an open invitation for spam and trolling. Instead, Drupal uses the Dublin Core extension of the RSS specification, which defines instead a Creator setting that asks instead for a name.

Here are the most common values from Drupal to use for these RSS settings: 

  • Title - Title
  • Link - Link to content (enable the “Output the URL” as text option)
  • Description - Body (set to “Summary or Trimmed”)
  • Creator - Authored by
  • Publication date - Authored on
  • GUID field - UUID (disable the “GUID is permalink” setting)

 

Image
Screenshot of the RSS settings corresponding to Drupal field values.


Create an RSS Friendly Date Format

The Publication date should use the following date format: Mon, 15 Oct 2007 14:10:00 GMT.

Create this date format at Configuration > Regional and Language > Date and Time Formats.

This uses standard PHP Date formatting. Here is the PHP string to use: 

D, d M Y h:i:s T


Once your date format is created, update your Authored on field to use this new format.

Image
Screenshot of RSS Feed Views display configuration of date format.


Configure the Author to Display a Person’s Name

If you are using the Authored on field to display the author, this will output the username. If you would like to display someone’s actual name instead, be sure you have a name field added to the User account. Then, add a Relationship in the View to the Content author.

Once you create and save that relationship in the View, you will be able to add the Name field from the User account.

Image
Screenshot of RSS Feed Views display author configuration.


Ensure All Other Views Settings Are Relevant

Since we inherited Views settings from another View display, there are probably other settings that aren’t relevant. For example, we want to show all items, not a pager.

Now save your View and you are all set!

Validate Your RSS Feed

To make sure your RSS feed conforms to the best practices defined by the W3C overlords, visit your feed page, save the XML file and paste its contents into W3C RSS Feed Validation Service.

If all goes well, you will get this friendly confirmation message, Congratulations! This is a valid RSS feed.

Image
Screenshot of RSS Feed Validation confirmation page which states, Congratulations! This is a valid RSS feed.


Conclusion

Despite some wonky default settings, Drupal makes it quite easy to set up RSS feeds to meet your exact needs. Your website now offers your audience a free, open, ad-free way to subscribe to and read your content in whatever RSS reader they wish. Plus, that little orange icon is a small symbol in defiance of corporate walled gardens and proprietary algorithms.

Leave a comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.