JavaScript EditorBest javascript editor debugger     Ajax website 



Main Page

Previous Page
Next Page

Starting an RSS Feed

An RSS feed is an XML document and as such must conform with XML syntax (see page 38). Over the next few pages, I'll show you how to write the whole thing with just a text editor. While you can create syndication feeds in several formats, RSS 2.0 is perhaps the most widespread and the most versatile. It's what we'll use in this chapter.

Figure 25.4. An RSS feed is an XML document. This means it must start with an XML declaration and then the <rss> root element. The syntax is persnickety but not particularly complex.


To start an RSS feed:

1.
Open a new text document with any text editor.

2.
At the top, begin the XML declaration by typing: <?xml version="1.0"

3.
Next, declare the character encoding as utf-8 by typing encoding="UTF-8".

4.
Complete the xml declaration with ?>.

5.
Next, declare that you're using RSS 2.0 by typing <rss version="2.0">.

6.
To begin the information about your site, type <channel>.

7.
Leave a few spaces for the rest of the feed (which you'll complete in the rest of this chapter) and then close the channel and rss elements by typing </channel> </rss>.

8.
Save the document as text only with the .xml extension. Make sure you encode it in UTF-8. (See page 333 for details.)

RSS Feed Generators

There are tools that facilitate creating RSS feeds but it's a little bit like using an accountant to do your taxes. If you hire an accountant, her job is to ask you questions about your last year's earnings, but the task of assembling that information still stays with you. Feed writers (like Feeder http://reinventedsoftware.com/feeder/), are similar. They provide dialog boxes where you enter the data and then they assemble the feed in the proper format for you. You have to weigh whether the cost and learning curve associated with such programs, as well as the loss of absolute control over the output is worth the automation that they provide.

And you can always do what I do: hire an accountant and tweak the results.


Tips

  • While the UTF-8 encoding is not required for all aggregators, it is required for some (iTunes among them), and is the norm.

  • RSS is case sensitive. <channel> is not the same as <Channel>. Follow the examples closely.



Previous Page
Next Page


JavaScript EditorBest javascript editor debugger     Ajax website