How to Create an RSS Feed
from wikiHow - The How to Manual That You Can EditRSS is a method of distributing links to content in your web site that you'd like others to use. In other words, it's a mechanism to "syndicate" your content.
Steps
- What is RSS?
- How does RSS syndication work? Say you publish a new web page about a particular topic. You want others interested in that topic to know about it. By listing the page as an "item" in your RSS file, you can have the page appear in front of those who read information using RSS readers or "news aggregators". RSS also allows people to easily add links to your content within their own web pages. Bloggers are a huge core audience that especially does this.
- What does RSS stand for? There's a can of worms. RSS as introduced by Netscape in 1999 then later abandoned in 2001 stood for "Rich Site Summary." Another version of RSS pioneered by UserLand Software stands for "Really Simple Syndication." In yet another version, RSS stands for "RDF Site Summary."
- History buffs might be interested that there's been some rivalry over who invented RSS. This is why we have both different names and indeed different "flavors" or versions of RSS.
- How does RSS syndication work? Say you publish a new web page about a particular topic. You want others interested in that topic to know about it. By listing the page as an "item" in your RSS file, you can have the page appear in front of those who read information using RSS readers or "news aggregators". RSS also allows people to easily add links to your content within their own web pages. Bloggers are a huge core audience that especially does this.
- At the heart of an RSS file are "items." No matter what version of RSS you settle on, your file will have to include at least one item. Items are generally web pages that you'd like others to link to. For example, let's say you just created a web page reviewing a new cell phone that's being released. Information about that page would form an item.To enter your item into the RSS file, you'll need three bits of information:TitleDescriptionLinkThe title and description of your item need not match exactly the HTML title tag of the web page that the item refers to, nor the meta description tag, assuming you use these. You can write any title and description that you think will describe the page. However, using your page's title and meta description tag certainly makes it easy to copy and paste to build your RSS feed.In the case of our example page, let's say this is the information we settle on to define it as an item: Recent Changes - WikiHow
Patrol all the edits that people have recently made to wikiHow!
http://www.wikihow.com/Special:Recentchanges
- Now we have to surround that information with xml tags. These are similar to HTML tags, with the exception that unlike with HTML, there's no set definition of xml tags. Anyone can make up a particular xml tag. Whether it is useful depends on the program that reads the resulting xml file. In the case of RSS feeds, they have their own unique set of XML tags that are defined. Use these correctly, and then anything that reads RSS will understand your information.Did that make your head spin? If so, don't reread - just carry on to see how simple it is. First, open a text editor like Notepad. We're going to build our RSS file using it.For your title, you need to start it with the
tag, then follow this with the text of the title, then end with the tag.For your description, you do the same, starting out with the openingtag, then following with the actual description, then "closing" with the tag.Next, we add the link information, beginning with , following with the actual hyperlink, then closing with . That gives us this:
<title>Recent Changes - WikiHow</title> <description>Patrol all the edits that people have recently made to wikiHow!</description> <link>http://www.wikihow.com/Special:Recentchanges</link>
Patrol all the edits that people have recently made to wikiHow!
http://www.wikihow.com/Special:Recentchanges
- Now there's one more thing we need to do. We actually have to define all this information as forming a particular "item," which we do using a special item tag.You place the opening item tag, "
- " at the top or start of all the information we've listed. You then place the closing item tag, "
", at the bottom or "end" of the item information. The finished product looks like this:
<item> <title>Recent Changes - WikiHow</title> <description>Patrol all the edits that people have recently made to wikiHow!</description> <link>http://www.wikihow.com/Special:Recentchanges</link> </item>
Recent Changes - WikiHow
Patrol all the edits that people have recently made to wikiHow!
http://www.wikihow.com/Special:Recentchanges
Congratulations! You've now made your first item. There's a bit more to do to finish our RSS file. First, what if we have other items we want to syndicate? Then we simply add more item elements, just as we did above. You can have up to 15 items. New items tend to be inserted at the top, with old items removed from the bottom, to make room for new stuff.
- With our example, let's see how things look if we add two more items:
<item> <title>Recent Changes - WikiHow</title> <description>Patrol all the edits that people have recently made to wikiHow!</description> <link>http://www.wikihow.com/Special:Recentchanges</link> </item><br><br><item><br><br><title>Main Page - WikiHow</title> <description>The main page of wikiHow!</description> <link>http://www.wikihow.com</link> </item> <item> <title>Help - WikiHow</title> <description>Need some help? This is where to go!</description> <link>http://www.wikihow.com/Help:Contents</link> </item>
- Having defined items we want to distribute, we now have to define our site as a "channel." You'll use the same tags as with the items: title, description and link. However, this time the information will be about your entire site, rather than a particular page. That means our channel information would look like this:
<title>WikiHow</title> <description>WikiHow - The How-To Manual That You Can Edit!</description> <link>http://www.wikihow.com</link>
WikiHow
- Now, how does something reading our RSS file know that the information above is for our "channel" when it looks just like item information? Simple. As long as we don't surround this information with an opening and closing
- tags, it won't be seen as item information but rather as channel information.
- tags, it won't be seen as item information but rather as channel information.
- There are a few last things we need to do. First, we need to add a tag at the very top of the file saying that this is written according to the XML 1.0 specifications. Right under this, we also have to say what RSS version we are using.So far, everything we've done is compatible with UserLand's popular RSS 0.91 version. However, it also matches UserLand's latest RSS 2.0 version, as well, so we'll define the file as meeting that specification. This will allow us to add other neat features in the future, if we want.Finally, after the RSS tag, we need to add an opening "channel" tag. That gives us this at the top of the file:
<?xml version="1.0"?> <rss version="2.0"> <channel>
At the bottom of the file, after all the items we want to syndicate, we have to insert a closing channel and RSS tag, in that order. Those look like this:
</channel> </rss>
- This means our complete file looks like this:
<?xml version="1.0" ?> <rss version="2.0"> <channel> <title>WikiHow</title> <description>WikiHow - The How-To Manual That You Can Edit!</description> <link>http://www.wikihow.com</link> <item> <title>Recent Changes - WikiHow</title> <description>Patrol all the edits that people have recently made to wikiHow!</description> <link>http://www.wikihow.com/Special:Recentchanges</link> </item> <item> <title>Main Page - WikiHow</title> <description>The main page of wikiHow!</description> <link>http://www.wikihow.com</link> </item> <item> <title>Help - WikiHow</title> <description>Need some help? This is where to go!</description> <link>http://www.wikihow.com/Help:Contents</link> </item> </channel> </rss>
- Saving The File - Now that we're done adding to the file, we need to save it. But what name shall we give it? As for the first part, that really can be whatever you like. For our example, let's say we just call it "feed.xml".Now that our file is saved, we can place it anywhere we want on our web server. Let's say we put it in the root or home directory. Then the address to our RSS file would be:http://www.wikihow.com/feed.xml
- Adding the Feed to Your Page -
There is one more thing left to do. To make it obvious that you have a feed on your page you should declare it in the head tag on your web page. To do this add the following code:
<link rel="alternate" type="application/rss+xml" title="WikiHow Feeds" href="http://www.wikihow.com/feed.xml" />
If everything worked, you should see the little orange RSS icon in your browser's address bar.
- Getting started will take time and isn't that easy, but after you know the basics it gets easier.
- For more technical details on RSS, read the RSS 2.0 specification
- A computer
- Internet
- Webspace
No comments:
Post a Comment