Adding Items to a Feed


The items are the individual articles that will show up in an aggregator. They can either be a teaser with a link to the full article, or they can include the entire story.

Figure 25.6. The item elements describe the individual articles in your RSS feed.


To add items to a feed:

1.

After the final element in the introductory section, as described on pages 380381, begin the first article by typing <item>.

2.

Describe your item by using one or more of the following elements. Again, use the syntax <tag>content</tag>:

Use the <title> element to identify each item in your feed.

Use the <link> element to point your visitors toward the full version of the article on your site.

Use the <description> element for either a summary, excerpt, or for the entire article. The description may contain (X)HTML (except for iTunes).

Use <guid> (which stands for globally unique identifier) to enclose a permalink URL or other unique value so that aggregators can have some way of uniquely identifying your feed articles. If the link is a permalink, add isPermaLink="true" to the initial guid tag. In this case, the guid element must be a URL.

Use <pubDate> to give the publication date for the item. The date must be formatted according to RFC 822 as described in the tips on page 381.

Use <author> for the email address of the person who created the item.

Use <category> to tag the article with a category so that it's easier for your prospective audience to find it.



Figure 25.7. An RSS feed's items are listed in the articles frame of most aggregators, like NetNewsWire, shown. Note how the first item in the RSS feed appears at the top of the list. The content of the description element is displayed in the content panel when the item is chosen. The content of the link element is used to create a link to the item's Web location out of the article's name. The link at the bottom of the content panel is created from the channel's link element.


Use <comments> to point to the URL where comments are allowed for your item.

3.

Type </item>.

4.

Repeat steps 13 for each article in the feed.

Tips

  • You can create as many items as you like. Add new item elements at the top of the XML document.

  • While no element is required, you must at least have either a title or a description.

  • You can add (X)HTML tags (though not for iTunes) either with a CDATA section (see page 319) or by substituting &lt; and &gt; for < and >.

  • You can also add an enclosure to an item, that can be downloaded with the article. This is the basic technique behind podcasts and is described on page 384.

  • I have not found a list of standardized category names, except for podcasts in iTunes as described on pages 388389. For text-based feeds, you might try looking at the feeds of similarly themed sites to see what they're using.

  • There are additional sets of elements (namespaces) that let you add more information about your item. For example, Flickr's feeds use the RSS Media Module (http://search.yahoo.com/mrss).

  • There is also a source element that can be added to an item, but it should be automatically generated by the aggregator when the article is forwarded.





HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net