04. September 2010 · Comments Off on Manual Creation of RSS 2.0 Feeds for Web Sites · Categories: Web · Tags: Web Development
Last updated on 08/30/2020

rss buttonThis guide shows how to manually create a basic RSS 2.0 feed for web sites quickly and easily. Although other methods exist for adding RSS to web pages, such as various RSS feed software tools, or using feed generation and feed conversion services, there may be limitations, or fee and registration requirements. Tutorials, videos and other instructions for creating RSS feeds are available from multiple web sites, but many can be confusing or contain outdated information. And since the RSS specification changes over time, usually by adding requirements, many software tools become obsolete over time.  With outdated software and RSS specification changes, many videos, tutorials and articles from only a year or two ago, if followed, can create RSS feeds that produce errors when submitted to a RSS validation service. In addition, many on-line feed generation and conversion sites have shut down or have changed from free to paid services. Because of these issues, it’s often desirable to create your own RSS feed. The good news is that creating your own RSS 2.0 feed isn’t terribly difficult.

The following information was tested to ensure that it worked. The method used for this guide was to create a RSS 2.0 feed using an XML file. The only tool needed is a text editor such as notepad, to create the XML file and for adding a line of  code into your HTML web page file(s) to notify browsers of the RSS feed’s existence.

Note: For the code shown below to work correctly, it’s better to type the code rather than copy and paste it. Quotation marks, apostrophes and other characters are sometimes changed by the copy and paste process and become unrecognizable by browsers and other programs although the changes are not always apparent to the eye.

Requirements for RSS 2.0

A feed file is a specially formatted XML file made up of elements and sub-elements, which are either declarations or tags. RSS requires only a few elements, but has many optional ones, so feed files can range from simple to complex. For this guide, the declarations and tags for the RSS XML feed file are grouped below into three categories: (1) required,  (2) optional (3) nice to have. As of this posting, RSS 2.0 feeds are more likely to validate and to be accepted by feed directories when ALL the elements for the three categories are included.

Required elements:

  • The XML declaration – This defines the XML version and character encoding (XML version 1.0 and UTF-8 encoding used for this guide).
  • RSS declaration – Defines the RSS version (2.0 used for this guide).
  • channel – The name of the web site. There must be a least one item (web page file/article) within the channel element.
    • title – Title of the channel element.
    • link – Link of the channel element.
    • description – Description of the channel element.
    • item – One for each article or web page file that makes up the web site. Must have at least one item.
      • title – Title of the item element.
      • link – Link of the item element.
      • description – Description of the item element.
  • Closing tags

Optional elements. Through testing, it was discovered that if the following elements are missing in the XML feed file, errors will result when the feed is validated using the W3C Feed Validator:

  • atom:link – Identifies the feed’s URL. Used in the channel element.  Makes the feed more portable, self-contained, and easier to cache. See workbench.org for more information.
  • guid – Globally Unique Identifier. A string that identifies each item element as unique. It has no rules for syntax. Used for each item element.

Nice to have. These elements are not required, but they are useful and almost always included in RSS feeds:

  • language – Identifies the language in the document. Often a requirement for submission to RSS directories.  Used in the channel element.
  • image An image to represent the channel in the channel element. Default size values are 88 for width and 31 for height. Max values are 144 for width and 400 for height.
    • url – Required if using the image element. URL of an image in png, gif, or jpeg format.
    • title – Required if using the image element. Describes the image. Identical to the channel’s title element.  Used for the ALT attribute in HTML rendering.
    • link – Required if using the image element. Link for the image. Identical to the channel’s link element.
    • width – Optional but recommended. Width of image in pixels. If omitted, image width is assumed to be 88.
    • height – Optional but recommended. Height of image in pixels. If omitted, image height is assumed to be 31.
    • description – Optional. Description of image used for HTML rendering.
  • pubDate – Date the item was published. If a future date is used, an aggregator may not display that item until that date.

W3C advises that because RSS is XML, keep in mind that:

  • All elements must have a closing tag
  • Elements are case sensitive
  • Elements must be properly nested
  • Attribute values must always be quoted

Putting all the above information together, below are the steps to create a working RSS 2.0 XML file that can be customized for a web site.

Note: For the code shown below to work correctly, it’s often better to type it yourself rather than copy and paste it. Often, characters are changed by the copy-paste process and become unrecognizable by applications using the code; even though the changes are not apparent to the eye.


Steps to Create a RSS 2.0 Feed

  1. Use a Text Editor to Create the XML Feed File

    1. Click feedxml to open the editable XML feed file in your browser or right click it and download it to your computer.
    2. Use a text editor to open the downloaded file or cut and paste the text from the browser page into your text editor.
    3. Customize the file as required for your web site.
    4. Save the feed file as feed.xml
  2. Add Code for RSS detection to your Web Page(s)

    1. To make the RSS feed detectable in web browsers, customize the code below and paste it between the <head> </head> section of the web page(s) you wish to be detectable and then save the changed file:
      <link rel=”alternate” type=”application/rss+xml” href=”https://www.yoursite/feed.xml” title=”Your title”>

    2. Add a RSS feed button to your web page(s) such as those from hongkiat.com.  Be sure to link the RSS feed button to the XML feed file.  Below is an example using a graphic file named feedicon.png:
      <a href=”https://yoursite.com/feed.xml”><img style=”border: 0px solid ; width: 28px; height: 28px;” alt=”feed icon” src=”feedicon.png” />
  3. Upload the XML feed file, modified HTML web page(s), feed image, and the RSS feed button graphic to your server

  4. Validate and publish your RSS Feed

    1. Use W3C to validate your feed either by direct input (cut and paste) or using your feed’s URL (https://yoursite.com/feed.xml). The RSS Advisory Board also provides a feed validation service. The validation process identifies errors and suggests corrections. Make corrections as needed until your feed is validated without errors.
    2. Submit your feed to feed directories to get more traffic. Many are free. A recent listing and review of RSS directories can be found at masternewmedia.org.
  5. All Done.


References and Further Info:

XML RSS feeds with Node.js

W3C Shools – RSS Tutorial

RSS Advisory Board

Xul RSS tutorial

RSS 2.0 at Harvard Law

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Print Friendly, PDF & Email

Bad Behavior has blocked 5105 access attempts in the last 7 days.

Spelling error report

The following text will be sent to our editors: