HowTo – Understanding RSS Feed Formatting

Filed under: Web Design

alinkRSS Feeds are often used by publishers as method of  distributing data about posts on their  site.

The method of producing the RSS Feed is usually integrated into the publishing platform like WordPress and generated automatically.  When you add a new post the feed is updated.

You could also generated the RSS File manually or through a specialized script that can access data sources like a product database for a retailer.

Format of an RSS Feed

RSS uses about 20 elements to show the data.

Its layout is very similar to a HTML page and uses Elements or Tags in the XML type format.

The basic format follows:

<?xml version=”1.0″ encoding=”UTF-8″?>
<rss version=”2.0″>

<channel>

<title>MySite RSS FEED</title>
<link>http://www.mysite.com/myfeed</link>

<item>
<title>Post About Something Interesting</title>
<link>http://www.mysite.com/post.html</link>
</item>

</channel>
</rss>

Mandatory Elements

This is where many people get confused.

Your feed needs 2 basic elements to validate a Feed or Channel Title and a Feed Link.

Everything else after that including content of your <items> is optional

The only other rule that you need to follow is the standard format of opening and closing Elements in proper order.

So, although your RSS Feed may Validate with many readers if you publish your feed for syndication you should follow the proper format rules of both RSS and XML.

Optional Elements

Optional Channel Elements language, copyright, managingEditor, webMaster, pubDate, lastBuildDate, category, generator, docs, cloud, image, textInput, skipHours, skipDays

Optional Item Elements

title The title of the item.

link The URL of the item

description The item synopsis

author Email address of the author

category Includes the item in one or more categories.

comments URL of a page for comments relating to the item.

enclosure Describes a media object that is attached to the item.

guid A string that uniquely identifies the item

pubDate Indicates when the item was published.

source The RSS channel that the item came from

Common Mistakes
Where people screw up is using elements for the wrong reason and relying on the visitors browser or reader to overcome their mistakes.

That is fine if you are trying to support 27 people that read aunt mables pie recipie feed but if you are publishing content that you want other sites to import or if you expect syndication through other methods you need to get a few things right.

use <links> for your links

use <titles> for your titles

use <guid> for your unique identifyers

use <description> for your descriptions

DO NOT USE A DESCRIPTION IN A ITEM AS ITS TITLE

Don’t use the guid as a link container

It is pretty basic formatting and to get things wrong really shows you either do not care about your work or your consumer.

When you publish a feed that uses a guid as a link then people that syndicate that feed need to adapt to your screwup.

They may be reading in hundreds or thousands of  items every hour and because you do not follow proper formatting of a 20 element language they will just give up on you and use someone else’s feed.

For more information visit

http://validator.w3.org/feed/docs/rss2.html