Create a simple RSS feed XML

An RSS feed is a simple way to make sure to subscribe to updates on your website. It is an XML file in a specific syntax.

Most website and Content Management Systems like WordPress, Drupal, or forum software like phpBB generate this RSS feed.

You can locate this RSS feed link on their website and use an RSS Reader like Feedly to display them.

Apart from the application reading RSS feeds, you can also display RSS feed on your website. For example, in WordPress, we can use a plugin like Super RSS Reader to display these RSS feeds.

There are a variety of applications for RSS feeds. Though RSS feeds are generated mostly dynamically by CMSes, you can write your own RSS feed file and distribute it.

You can also display it using an RSS Reader on your website. Just manually edit the RSS feed XML file and the RSS reader shows the updated content.

These RSS feeds are nothing but a standard to display data in a specific structure/syntax. In this article, let’s see how to build an RSS feed file manually.

The RSS Feed Example Structure/Syntax

Below is an example of an RSS feed. You can copy this content and paste it to a file with the extension “.xml”. For example apple.xml

Upload this XML file to your web server using FTP or any other means that it supports. You can now access this file from your website like https://example.com/apple.xml

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

<channel>
  <title>Apple RSS feed</title>
  <link>https://www.example.com/apple.xml</link>
  <description>This RSS feed is about Apple products</description>
  
  <item>
    <title>Apple iPhone</title>
    <link>http://example.com/iphone/</link>
    <description>The iPhone is a line of smartphones designed and marketed by Apple Inc</description>
  </item>
  
  <item>
    <title>Apple MacBook</title>
    <link>http://example.com/macbook/</link>
    <description>The MacBook is a brand of Macintosh notebook computers designed and marketed by Apple Inc</description>
  </item>
</channel>

</rss>

Let’s see the RSS feed line by line

The first line in the file is the XML declaration. It defines the XML version and the character encoding used in the XML document.

In this example, we are using the version 1 of XML with a character encoding of UTF-8

The second line <rss> is the root XML tag. It defines the XML file as an RSS feed.

The third line is the <channel> tab. It describes or gives a summary of the RSS feed. It has 3 required elements. There are more optional elements which you can use to add more details.

In this example, our RSS feed is about a list of Apple products.

  • <title> – The title of the RSS feed
  • <link> – The URL of the RSS feed
  • <description> – The summary of the RSS feed.

The fourth line is the <item> tag. An RSS feed will have multiple <item> tags and they must be under the <rss> tag. These <item> describe the individual feed items. These can be a post, product, event, podcast, or anything. 

Just like the <channel> tag, it also has 3 required elements. In this example, our RSS feed contains items about Apple products

  • <title> – The title of the RSS feed item
  • <link> – The URL of the RSS feed item
  • <description> – The summary of the RSS feed item.

The XML file ends with the closing tag for <channel> and <rss>. Note: all XML tags must be closed.

That’s it, you have created an RSS feed. You can use an RSS validator to validate this feed.

Conclusion

You can now pass this RSS feed to any application i.e an RSS Reader, and distribute it for others to subscribe to.

If you are using WordPress, then you can use a plugin like Super RSS Reader and display custom content you want in the sidebar or inside posts using shortcodes.

You can also automate some stuff using services like Zapier or IFTTT where an RSS feed will be the trigger.

I hope this article was useful. Please do share any comments you have in the comments section below.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter

Add your comment 2 Comments so far