Feed Your Feed!

 

coding

Page history last edited by Jewel Makda 1 yr ago

All tags in an a feed are called "elements."

 

Below is a breakdown of the required elements along with a recommended namespace:

 

Specifies this document conforms to the xml version "1.0" specification.

<?xml version="1.0"?>

 

The rss element is the top-level element of an RSS feed and says it conforms to the RSS specification "2.0". Later we include a namespace and need to declare that namespace at the top of the feed.

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

 

The RSS element must contain a channel element.  The channel element requires three child elements: title, link and description.

* Optional elements: category, cloud, copyright, docs, generator, image, language, lastBuildDate, managingEditor, pubDate, rating, skipDays, skipHours, textInput, ttl and webMaster.

<channel>

 

According to the RSS Advisory Board's Best Practices Profile, identifying a feed's URL within the feed makes it more portable, self-contained, and easier to cache. For these reasons, a feed should contain an atom:link. The link must have the rel attribute "self", an href attribute containing the feed's URL and may have a type attribute of "application/rss+xml". Earlier we declared at the top of the feed we were using an atom namespace.

<atom:link href="http://www.example.com/simplefeed.xml"

    rel="self"

    type="application/rss+xml"

 

The title element provides the name of the feed.

The link element provides the url associated withthe feed.

The description element provides a summary of the feed.
            
<title>Title of the Feed</title>

             <link>http://www.example.com/index.html</link>

             <description>Description of the feed so users know what they are subscribing to...</description>

 

An item element represents the content published in the feed. A channel may contain many items or no items at all.

An item requires either a title or description element. The link element is not requires but is almost always used. To add new items just add them here.  Usually the most recent are listed at the top.

* Optional elements: author, category, comments, description, enclosure, guid, link, pubDate, source and title.

<item>

        <title>Title of item 1 in feed</title>

        <link>http://www.example.com/example.pdf</link>

        <description>Descripton or synopsis of article or content item links to...</description>

     </item>

 

Now we need to close our rss and channel tags. 

</channel>

 </rss>

 

That's all you need to get started building your rss feed. Click here for the full example.

Comments (0)

You don't have permission to comment on this page.