Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
One way that websites exchange information is via a format called RSS or Really Simple Syndication. Drupal has a feature built-in that let's you both publish information from your website and subscribe to information from websites throughout the Internet. Before we get into talking about how Drupal publishes and subscribes to RSS feeds, here's a brief description of what RSS is. RSS is typically a format for publishing serial material such as blogs, periodicals, and community sites. It's used for publishing information that's updated frequently, for example, a newspaper would publish its news stories through RSS. It doesn't make much sense to publish static information through RSS since the newsreaders grab it and then replace the old information with new information. If your information doesn't change frequently, it would quickly be pushed to the bottom. In RSS, content is syndicated through a feed or a channel. You may hear both words. That content is then viewed through either a reader or an aggregator. A reader usually refers to a piece of software such as Apple Mail, whereas an aggregator usually refers to a website. There are many websites that will actually let you look at RSS content including Google and LiveJournal and in fact, any Drupal site will let you aggregate RSS feeds from throughout the Internet. So, that's the theory, but what is RSS in practice? Let's take a look at few sites to see how it works. We'll start with Drupal.org, which makes a lot of information available as an RSS feed. For example, if you wanted to see all the stories that appear on Drupal.org's front page, but you don't want to have to keep checking the website, you could subscribe via RSS. To do that, you would click on the little RSS symbol in your web browser and it would show you the page that you would need to include. In this case, it's drupal.org/node/feed. You would put that in your RSS reader and it would then feed these stories in as they became available. That little RSS symbol shows up on many, many websites.
Here's another. This is the page groups .drupal.org/bayarea and it keeps track of all of the Drupal related activity in the San Francisco bay area. One again, if you wanted to subscribe to it, you would clear here and get your feed here in the address bar. This would then be copied into your RSS reader. There's one other place that provides RSS feeds that I found very useful for running a new site that's Google. Let's search Google .com for waterproofing. Now, we don't see it from the search results here but if you go to Google News, this is all of the most recent news for which the word, waterproofing, has appeared in the title or the body of the story. We click on RSS, subscribe to the RSS feed instead of the Atom feed, since there can be many different kind of feeds on a particular site and we get our URL. We are going to come back to this later and subscribe to this in our Drupal site.
First, we have to turn on the module, Aggregator. So, we'll go back to our website and do that. We do that through Administer, Modules, scroll down until we get to Aggregator, click on Enabled and as always, go to the bottom of the page and click Save Configuration. As with most modules, we are going to have to change the permissions to give our users the rights to see everything that comes through that news feed. So we go to Administer, scroll down to Permissions and we see the aggregator module. We are going to give authenticated users and anonymous users the right to access our news feeds.
Again, Contributing user is also an authenticated user because this is a group that we added before. Scroll down to the bottom and Save permissions. Now, let's take a look at how we can actually add feeds to that aggregator. We go to Administer and search for aggregator and there it is. Click on it and we have a choice of adding feeds at the top. We can also add categories, which we won't discuss at this moment. Let's just add ourselves a feed, click on it, it asks for the title and the URL. We are going to go back to that one that we found earlier which was about waterproofing from Google's News search. To subscribe to this feed in our Drupal site, we go up here, select all of it by doing Command+A on the Mac or Ctrl+A on the PC and then Command+C to copy on the Mac or Ctrl+C on the PC. We'll then switch back to our Drupal site, go to Administer, Feed aggregator and Add feed.
For a title, I am going to call it News from Google - Waterproofing. And for the URL, I'll use Command+V or Ctrl+V on the PC to paste it in. Now, there is a problem with this URL, which has to do with our particular browser. If we go back to the beginning of it by hitting Command+A and then Backspace or Ctrl+A and then Backspace on the PC, we see that it starts with feed. This has to start with http. Most browsers don't have this issue and in fact, Firefox doesn't. If you are using Firefox, you won't have to take this additional step.
The final option we have here is the Update interval. This determines how frequently we'll be fetching news from this URL. Because it is only updating once every 15 minutes, we are allowed to do no faster than that because if we were allowed to and everybody did, then it would overwhelm the servers. However, we can't do it less frequently if we like. I recommend keeping it on 15 minutes because that's no too frequently to overwhelm the servers but at the same time, it's frequently enough that somebody, who checks your site several times a day, will generally find new information whenever they go back as long as there is that new information.
Then we'll click on Save. If you want to pull it in immediately, we'll click on this link here, cron maintenance task that takes us to our status report and then you say, run cron manually. Now, when we go over to Feed aggregator, we'll see all of the stories on our website. Let's go to our ordinary user, Fishy Joe, who we have logged in on the Firefox browser. If we refresh this page, we see that he now has a Feed aggregator and when he clicks on it, he can see all of these stories. There are a few links he'll notice. One of then is he can click on the title of the story itself and that takes into the original story directly. We'll go back and if he clicks on News from Google - waterproofing and remember, that's the feed that we set up, we see all of the news items that were fetched by that feed.
Finally, we can look at Sources here. So, here we can see all of the news stories that came in through our Google waterproofing feed. If we had other feed setup, we'd see them listed below with all of their items. There's one other thing that we can do with RSS feeds and we are going to switch back to our administrator interface to show you. Here in the administrator interface, we can take this feed and put it in a block and we'll put that in the right-hand column along with our other blocks. To do so, go to Administer and then to Blocks. Whenever you create a feed like this, it shows up as a separate block. As we scroll down, we see it here, News from Google - Waterproofing feed. We'll bring that up into the right side bar and save it and voila! We actually see it here in the right- hand column and indeed, we don't see the entire story; we only see the headlines, which is yet another way that you could make your site look fresh and new.
As with any other block, you could move that around within the column or you could move it to the left-hand column. I think I'll put it above the most recent poll. Scroll to the bottom again, Save blocks and let's switch to our ordinary user just to see how it looks. And there you have it, we now have Google's waterproofing news followed by the poll just as we expected. As with most Drupal topics, there is a section on the Drupal.org site specifically for aggregation tricks. It's at drupal.org/handbook/modules/aggregator. So, we have learnt how we can subscribe the information in your Drupal site but you can also publish information that appears on your Drupal site. To show that, let's go back to our home page by clicking on our Drupal icon up here. Now, let's move to becoming part of the grand pool of RSS publishers. In Drupal, you actually don't have very many options for how you publish your content in RSS. If it appears on your site and is visible to anonymous visitors, it can be subscribed to via RSS.
So somebody, who goes to your site, would see this RSS tag up here. In this case, we are running on a local machine, so we see localhost. But of course, somebody, who was looking at it on a public web server, would see, for example, www.example.com. When they click on RSS, it adds that rss.xml and they would subscribe in their reader exactly as they would in any other site. There's one thing that I want to point out here though. One of our stories, we added to teaser that is text that shows up before you click Read more and then additional text that shows up after your click Read more. That carries over whenever you do an RSS feed. The first Read more showing here, shows where the teaser cuts off. The second Read more shows up at the end of the content itself, so you can actually cut off content before the end by adding a teaser break.
Being able to subscribe to RSS feeds tremendously increases the amount of content on your site and can beautifully compliment your own content.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.