RSS structure
RSS sounds great, but how can you actually implement it? To do this you need to create an RSS list (commonly known as a "feed"). RSS feeds are built using a specific format.
This tutorial focuses on:
- File creation
- Core declarations
- Comments
- Adding content
File creation
RSS feeds are built using XML so to begin creating an RSS feed, first open a new blank page in your code editor and save it with the .xml extension.
Core declarations
Add these two lines to your file:
The first line is the XML declaration which specifies the XML version as well as the character encoding being used. The second line is the RSS declaration which specifies that this file is an RSS document, specifically RSS 2.0
Comments
Comments in an RSS file are written the same way as they are written for HTML.
Adding content
You've declared that your file is going to be an RSS file, now lets add some content! We will need five tags to do this - <channel>, <title>, <link>, <description>, and <item>
The <channel> tag is used to describe an RSS feed. Within the <channel> tag, the <item> tag is used for each item in the RSS feed. Both these tags have three required child tags:
- <title> - sets the title of the RSS feed/item
- <link> - specifies the URL where the RSS feed/item content can be found
- <description> - sets a description for the RSS feed/item
Check out our RSS channels and RSS items pages for more information on <channel> and <item>.
NOTE: Remember to keep in mind XML syntax rules when creating RSS feeds - All tags must have a closing tag, be in lowercase, and in the correct order. All attributes must be in lowercase and attribute values must be quoted.
