In this example you will create a Feed display to show nodes by individual users, dynamically selected through the URL. You will become familiar with the Views 2 interface, as well as learn how to use an argument to pull in a user name and use it in a dynamically created path.
A feed is a data format that places your site's content into a file that can be read and displayed by news reader programs. When visiting a site, you may notice a small RSS transmission icon, whereby clicking on it, you can subscribe to the site's most recent content. This makes it easier for your visitors to keep up to date with your website. You can also use this format to aggregate information into other sites. For more information, please watch a video from Common Craft about RSS in plain English.
Note, Drupal automatically creates a feed for your website, but you may want to create feeds with specific information. In this case, a list per user.
Creating a new view
- Go to add new view. Give it the name 'user_feed', description 'A feed of user nodes.', tag 'users', type 'Node' and click Next.
- About the Interface. You have been brought to the Views User Interface. As you start, you are editing the "Default" options for the view. In the 1st column on the left- you can see the pull-down menu offers 'Feed', for example, to select settings specific only to RSS views. In the remaining columns, you will be able to add or change options by clicking on links or icons. These options appear below this main area. Most likely, you will need to scroll to see the options appear. As you make changes, these options will appear in bold until you save your view.
Change default display
- Under Basic Settings in the 2nd column, click Row style: Fields
- A menu loads below, Defaults: How should each row in this view be styled, check the Node option, and click Update.
- This loads another options menu, Defaults: Row style options click Update.
Create the RSS view
- In the 1st column, select 'Feed' in the drop-down menu, and click Add Display.
- Under Basic Settings in the 2nd column, click Row style:Missing style plugin
- Note, options appear below the Views Interface, you may need to scroll to see Feed: How should each row in this view be styled
tick Node, then Update
- This loads the next options menu- Display type: select "Use default RSS settings", click Update.
Set the path for accessing your feed
- In the 2nd column under Feed settings, click Path: None
- In options below Feed: The menu path or URL of this view enter in the path with an argument feeds/%/rss.xml
- Click Update
Set up your arguments to say which user's nodes to display
- To the right of Arguments, click the + sign to add and argument
- In the Feed: Add arguments menu that loads below, select User in the pull-down menu
- Check the box User: Name, click Add
- Scroll down to options to find Case in path: select Lower case
- Check the box Transform spaces to dashes in URL
- Click Update default display
Sort to show most recent at top of feed
- Scroll up to Sort criteria in the right most column and click the + icon.
- In the Groups drop-down menu below, select 'Node', then check Node: Post date, and click Add.
- Select Descending Sort order. Click Update.
Set filters to hide unpublished entries
- Click the + icon next to Filters. In the options below, select Node under Groups drop-down menu, choose the Node: Published filter, and click Add.
- Check the box Published. Click Update default display
- Click Save
- Under Live preview type in the name of a user, in lowercase, replacing spaces with dashes, click Preview.
- You should test and find your feeds at URLs like http://yoursite.com/feeds/user-name/rss.xml
- You can use this path for aggregating on another site. You can also attach the RSS feed to another display of view to make the feed link appear on that display.