Simple Web Syndication with RSS 2.0 - Expanding the channel
(Page 4 of 6 )
There are a number of optional elements that you can use to add the effectiveness of your channel. These elements are used to provided additional, more specific information about your content.
There are additional elements at both the channel level and the item level. The additional channel elements are used to improve indexing and to provide additional information about your channel to your readers. The additional item elements are used to provide additional information about your content and to help ensure that your feed updates properly in news readers.
We’ll begin with the additional channel elements. You may or may not need to use all of these. The rule of thumb is to add as many as you can so that your feed contains as much information as you are able to provide. The following table lists all of the additional channel elements.
Element | Description |
copyright | The copyright notice for your channel. |
managingEditor | The email address for the person responsible for the item content. |
webmaster | The email address of your contents technical contact. |
pubDate | The publication date of your content. |
lastBuildDate | The last time the channel feed was updated. |
category | Used to specify categories that your channel belongs in. Valid values will be provided by the listing service or the site that your feed will appear on. |
generator | A string that indicates the program that generated the channel. |
docs | A URL pointing to the documentation for the RSS specs that were used to build this channel. (For reference purposes) For RSS 2.0 this will always be: http://blogs.law.harvard.edu/tech/rss |
cloud | Used to provide information for the rssCloud interface. |
ttl | Time To Live – indicates how many minutes a channel can be cached before the news reader refreshes it from the source. |
image | A gif, jpg, or png that can be displayed as your channels thumbnail. |
rating | The channel’s PICS rating. |
textInput | Used to provide a text box for user input however support for this element is extremely limited. |
skipHours | A value between 0 and 23 that tells news readers when not to update your channel. |
skipDays | A value containing a day of the week that tells news readers when not to update your channel. |
Again, you will not use most of these elements. I’ll show you only the ones that relate to my channel. For complete documentation, you can visit the RSS 2.0 Specification on the Harvard Technology site.
My updated channel portion looks like the following:
<title>Popular Articles by Nilpo</title>
<description>Popular articles by Nilpo published by Developer
Shed.</description>
<link>http://www.nilpo.com</link>
<language>en-us</language>
<copyright>Copyright © 2006,2007 Developer Shed, Inc.</copyright>
<managingEditor>contacteditor@developershed.com</managingEditor>
<pubDate>Sat, 13 Jan 2007 00:00:01 GMT</pubDate>
<lastBuildDate>Sat, 13 Jan 2007 00:00:01 GMT</pubDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<ttl>1440</ttl>
Here I’ve just added some additional information about my channel that will help news readers update it properly. Some confusion arises between the pubDate and the lastBuildDate. Many times these values are the same. Basically, the pubDate indicates when the newest content went live. The lastBuildDate indicates when the channel feed (rss page) was generated.
If I had a cron on my website that auto generated my RSS channel daily, it would update the lastBuildDate each time it ran. The pubDate would only be updated when it found new content. The lastBuildDate and pubDate should both be listed in GMT.
The ttl element tells news readers to only update my rss feed once a day. Since articles on Developer Shed are only released once a day, there’s no point checking any more than that.
Next: Expanding your content listing >>
More XML Articles
More By Nilpo/Developer Shed Staff Writer