Using views to publish both full and partial feeds in Drupal
There's a long standing debate over the content of RSS feeds. For the greatest convenience of your readers the full RSS feed is great, because they can read your articles in their feed aggregator. However as a publisher who needs to earn a living from my writing I only want to publish a teaser so that the reader will feel incentivized to visit my site. For me the feed is a lure to bring people to my site, and I cannot do justice to others' viewpiont.
By default Drupal has a global setting over whether to publish a full or partial RSS feed. This is in the 'RSS Publishing' admin screen, you can select the number of items to publish and whether it's "Titles only", "Titles plus teaser" or "full text". One might think this is draconion for what if you want to publish both a full and partial feed?
For example there are sites who can aggregate your feed giving your writing more visibility. Some of those sites demand you publish a full feed. Hence if you prefer a partial feed but want to aggregate your blog into a site which demands a full feed, you could be stuck.
Ta da! It's views to the rescue!
Seriously, views is the solution for almost everything in Drupal that isn't solved by CCK. Let's look at how to implement this requirement in views.
Start by defining a view. For example let's take the frontpage view that comes default with views 2. By default it provides a default display, a page display, and a feed display. Recall that a given view can have multiple displays so that the data gathered by the view can be presented in multiple formats. The page display is configured to mimic the default "river of news" in the default front page on a Drupal site. However given that it's a view the page display can be changed to anything you like. This gives you some incentive to use the frontpage view for the frontpage on your site.
In this tutorial, however, we're looking at the feed display at the moment. The built-in feed display uses the system RSS defaults (the 'RSS Publishing' admin screen) and lets leave that alone. Note the URL for the built-in feed as we'll want to create a second URL with a similar name.
Let's create a second feed display. Go to Administer » Site building » Views and in your list of views click on frontpage's edit link. If instead you want to implement this full feed to a different view, click on its edit link of course rather than frontpage's edit link.
This brings us into the views edit UI for our view. Turn first to the display list that's at the left side. In the dropdown list select 'Feed' and click on Add Display. It should end up looking like this:
In yours the word 'Feed' will show up twice in the display list. Click on the second 'Feed' entry to make sure it has an arrow in it. We're going to make a few changes in the basic settings.
Click on the Row Style and make sure it is set to Node as shown, then click on Update. Next click on the little widget at the end of that row, this lets you change the style options and make it as follows:
It's this setting which makes this feed a full feed. To publish both a full and partial feed you must have two feed displays, and they must differ on this specific setting.
Click on the style row to make sure it is set to "RSS Feed", then click on Update. Then click on the widget at the end of that row and there are two style options to set, whether to use the site mission for the feed description, and the name of the feed.
Next click on the Name because we'll want this feed to have a different name. Enter 'Full feed' or whatever it is you wish to use.
You may want to change the number of items published in the feed. Click on the number next to 'Items to display':
First make sure to click on Override. Next enter a number in the box. Then click on Update.
The last thing you must do is set a path for the feed. Click on the text next to Path, enter a path, then click Update. Here I show the path being "fullfeed.xml". It's perhaps more organized to name the full feed path similarly to the other feed path. So if the other one is named 'rss.xml' then this one could be named 'rssfull.xml' or 'fullrss.xml'. That said the name is up to you and is totally arbitrary. Naming it 'fred.xml' is quite possible.
When you've made all these changes click on the Save button at the bottom. The last thing to do is click on 'View "Full Feed"' so you can inspect the resulting feed.