Enhancing an RSS Feed Item

Optional elements to make your channel’s items more useful.

Optional Item Elements

  • <author>
  • <category>
  • <comments>
  • <enclosure>
  • <guid>
  • <pubDate>
  • <source>

<guid>

As mentioned under Building an RSS Feed: Compatibility: The guid element is a unique identifier that feed readers can use to identify if the user has viewed an item. It usually takes a form that is identical to the link element.

The guid element has one attribute, isPermaLink, which if set to true means that the guid must be the permanent link to the webpage associated to that item. It is often that same link as used for the page’s canonical URL in the header.

<guid isPermalink="true">https://www.htmlhobbyist.com/news/0001/</guid>

<pubDate>

The <pubDate> element for items designates the publication date of the item and adheres to all the requirements of the <pubDate> element for Channels.

<pubDate>Tue, 21 Jun 2022 12:12:12 +0000</pubDate>

<author>

Similar to the managingEditor and webMaster elements in the channel element, the author element allows you to designate the name and email address for the person who authored the item. The author element must contain an e-mail address. Using the author element might be considered unnecessary for a syndicated feed with a single author, but it could provide useful in cases where the item gets separated from the channel (as in the case of aggregated feeds).

<author>nelilly@noreply.htmlhobbiyst.com (N.E. Lilly)</author>

Some people do not use this element to avoid exposing contact information to potential SPAM.

<category>

You can use this for general categories from your feed and for relevant tags that relate to the content of the individual item.

The <category> element for items adheres to all the requirements of the <category> element for Channels.

<category domain="https://www.spacewesterns.com/articles/">Fiction</category>
<category domain="https://www.spacewesterns.com/tags/">Buck Rogers</category>
<category domain="https://www.spacewesterns.com/tags/">Armageddon 2419 A.D.</category>
<category domain="https://www.spacewesterns.com/authors/">Philip Nowlan</category>

<comments>

<comments> https://www.spacewesterns.com/articles/bat-durston-space-marshal#comments </comments>

The location of the comments received in response to the item. This could be a separate feedback page, another website supplying a comment service, or just a location with the same page as the item.

On a low tech website you might even make this a link to a letters to the webmaster page.

<source>

The <source> element allows you to attribute the original source from which you may be republishing items, by name and URL.

<source url="https://rss.nytimes.com/services/xml/rss/nyt/Technology.xml">NY Times: Technology</source>

In your own aggregated feed, this could point to your other, more singular purpose feeds.

<source url="http://www.htmlhobbyist.com/changelog.xml">HTML Hobbyist Changelog</source>

<enclosure>

The <enclosure> element allows you to link a media file to the item. like an image, audio file, or video recording. This is what made RSS feeds like podcasts possible before streaming media.

The interesting thing about enclosures is that a feed reader can download the files at any time, so that they’re available when the user is ready to engage. This was relatively groundbreaking when enclosures were developed.

<enclosure url="https://www.htmlhobbyist.com/audio/dial_up_modem_noises.ogg.mp3" length="664223" type="audio/ogg"/>

The enclosure element has three required attributes:

url
The URL to the media file.
length
The file size of the media file in bytes.
type
The media type of the file: image/jpeg, audio/mpeg, video/mp4, etc.

You should only include one enclosure per item. Including multiple enclosures in a single item is not supported in all feed readers.