RSS items
For each item in an RSS feed, the <item> tag is used (within the <channel> tag). There are three required child tags for the <item> tag:
- <title> - sets the title of the item
- <link> - specifies the URL where the item content can be found
- <description> - sets a description for the item
We discussed the core aspects of the <item> tag in the RSS structure tutorial, but there is much more you can do with it. Besides it's required elements, the <item> tag has a bunch of optional elements.
author
Specifies the email address of the author of an RSS item.
Example:<author>admin@landofcode.com</author>
NOTE: Including the author element in an RSS file may result in spam.
category
Specifies a category for an RSS item. This makes it possible for RSS feed readers to group the content that the item is set for in its appropriate category.
Example:<category>HTML tutorial</category>
comments
Specifies a URL where comments about an RSS item can be found.
Example:<comments>http://www.landofcode.com/rss/comments.php</comments>
A complete RSS file with optional and required elements for the <item> tag:<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
<title>Landofcode.com web tutorials updates</title>
<link>http://www.landofcode.com</link>
<description>Web development tutorials</description>
<item>
<title>Online code editor</title>
<link>http://www.landofcode.com/online-code-editor.php</link>
<description>New functionality added to the code editor. Check it out!</description>
<comments>http://www.landofcode.com/rss/comments.php</comments>
</item>
<item>
<title>Errors fixed</title>
<link>http://www.landofcode.com</link>
<description>Fixed a bunch of errors. Site runs much better now</description>
<author>admin@landofcode.com</author>
</item>
<item>
<title>HTML tutorials</title>
<link>http://www.landofcode.com/html-tutorials/</link>
<description>Five new tutorials added to the HTML tutorials section.</description>
<category>HTML tutorial</category>
</item>
</channel>
</rss>
For a full list of item elements (optional and required) check out our RSS item elements reference page.