共用方式為


Creating an RSS Feed

I've had several people ask me lately and have seen questions on Office Online about how to create an RSS feed. For those of you who don't know what an RSS feed is, it's something that people can use to keep up to date with the content on a site. Generally, sites that frequently publish content, like news sites or magazines, offer RSS feeds to which visitors can subscribe. Then when they publish content, they update the RSS feed and people who have subscribed to the feed will get a list of newly published content. (This is probably a somewhat simplistic explanation, but that's it, in a nutshell.)

If you have a site that contains content, such as articles or stories, and you frequently update the site, then you may want an RSS feed to help your customers keep up with your updates.

What is RSS?

RSS stands for Really Simple Syndication (although I've seen some sites refer to it as Rich Site Summary, also). RSS is basically an XML document that conforms to a specified XML schema. Short of regurgitating all the information that is available to explain RSS, I'll let you review the following resources. The all contain great information about what RSS is.

What is RSS?
Introduction to RSS (from webreference.com)
RSS Tutorial for Content Publishers and Webmasters

These are just a few. There are a hundred and one more resources for RSS; do an Internet search for "RSS", and you will likely come up with your own list of resources.

There are several different versions of RSS schemas, many created by various organizations. (The first link in the above list (What is RSS?) provides a table that briefly describes each version.) I'm sure there are experts in RSS who have an opinion about which one is the best to use. I'm not an expert, so I'm not making any recommendation. The schemas can vary some minimally, others hugely.

RSS 2.0

To help you understand how the schemas work and how to create your own RSS feed, the following XML code shows the basic XML for RSS 2.0, which is the version MSDN uses.

 <rss version="2.0" xmlns:dc="https://purl.org/dc/elements/1.1/">
 
   <channel>
     <title></title>
     <link></link>
     <description></description>
 
     <item>
       <title></title>
       <link></link>
       <description></description>
     </item>
 
   </channel>
  </rss>

Before I get too far, I should explain that this is not a schema reference. Technology at Harvard Law has a great RSS 2.0 Specification schema reference that you should use if you need specific information about the elements. Plus I stripped down the XML above (for example, I removed the comments sections) so that you could see the XML without all the added text.

Briefly, each RSS feed that adheres to the 2.0 version contains one channel element. Some of the child elements for the channel element are optional, but the title, link, and description are required. The channel element may contain one or more item elements. Many of the child elements for the item element are optional, but the title, link, and description are required. The above example provides the required elements for both the channel and item elements.

If you think of an RSS feed like a newspaper, the channel element contains the name of the newspaper, a link to the newspaper's Web site, and a description of the newspaper; then each item element is a different story in the newspaper, each containing the title of the story, a link to where the story can be found online, and a description of the story, which in some cases may be the full story.

Publishing your RSS file

Now that you've been introduced to one RSS schema, and you've likely read a bit more about the different versions, you should be ready to create your own RSS file for your Web site. You can create and edit your RSS file in FrontPage, Visual Studio, Notepad, or another XML or text editor. Once you've created it, you need to save it as an XML file (with a .xml extension) and upload it to your Web site.

Then you need to create a link so that people who want to can subscribe to it. Generally, you will want to use the little orange XML graphic and link the image to the XML file. I've noticed that most sites that have RSS feeds use the little orange XML graphic or a slight variation, but not all. I'm not sure if there are any rules about using the orange graphic, but it's very easy to identify so that those who are looking for an RSS feed on your site can easily find it. To get a copy of the image, just right-click on the image and save it locally, and then upload it to your Web site.

After you've created your first RSS file and provided the link to it on your Web site, all you need to do is update the file when you publish new content -- daily, weekly, monthly, or whatever works for you. I suggest that you don't save the same RSS file multiple times with different filenames. If you do, those who have subscribed to your RSS feed won't be able to keep their news aggregators updated without pulling the URL to the new file. Just update the file and reuse the same filename.

The RSS files that I reviewed had the most recent content at the top of the file. This allows subscribers to easily find the new content and move on. Again, I'm not sure if there are any rules to this, but if you want to know how subscribers will view your feeds, I would suggest either buying an RSS news aggregator or downloading a free trial version. I use Newsgator in Outlook, but there are many different news aggregators, so do some research to see which one works. In addition, different news aggregators may display the RSS feeds differently, so you may want to install more than one to see what the differences are.

Well, that's it. About the only thing I've done here is provide just basic information. There are many many many more resources online that will provide more detailed information about RSS and how to create your own feed. If you're new to XML, I highly suggest becoming more familiar before starting to create your own RSS feed. Once you have a basic understanding of XML and RSS, you should be able to create the RSS feeds you need for your own Web site.

Comments