Blog / Introduction to Using and Creating RSS Feeds
If you've ever wondered what that little orange icon on some webpages is, or heard the term "RSS" but didn't know what it meant, this post is for you. There are two sections— first, how to use a RSS reader, and second, how to create a RSS feed for your own site. If you're not sure what either of these things are, read on.
RSS stands for "Really Simple Syndication." It allows users to subscribe to a summary of website updates (usually, blog postings). On the server side, information about updates to a website is inserted into a XML file formatted in a standardized way, called a RSS feed. On the client side, an application called a RSS reader, which can understand this format, is used to check for updates to the site. Think of it like email or social media notifications, except rather than the RSS feed "pushing" update notifications to the subscriber, the subscriber is the one "pulling" updates by checking the RSS feed for changes. The benefit of doing it this way is that you don't have to make any accounts and it's not complicated to use or set up.
How to Use RSS to Subscribe to Website Updates
You will need a RSS reader application or browser extension installed. Any will do, as long as it gives you the option to use local storage. You shouldn't have to make an account or anything.
To subscribe to a site's RSS feed, find the URL for the site's feed.xml.
It's usually http://[name of site]/feed.xml;
in a browser, clicking the RSS icon or links that say "RSS" should take you there.
For example, the one for this site is here.
Once you have it, add a new feed in your reader, and put that full URL in when it asks for the address.
You should see some notifications about posts in your "inbox."
That's all there is to it.
Example
The following screenshots show FeedReader, which is GPL-licensed.
Adding https://gentoo.org/feed.xml.
Reading the feed for gentoo.org. Double-clicking opens the full blog post in a browser.
How to Configure a RSS Feed for Your Website
Setting up a RSS feed for your site amounts to creating an XML file with specific content.
It should be named feed.xml and placed in the root directory of your site.
There are only really two components to it: a description of the "channel" (feed/site), and the list of updates.
Many HTML templating engines and such can procedurally create and edit this file for you,
but it's straightforward to do by hand, as I will explain here.
Below is a sample feed.xml with only the required elements.
File: feed.xml
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>MachineFossil</title>
<link>https://machinefossil.net</link>
<description>Art and open-source software</description>
<item>
<title>Introduction to Using and Creating RSS Feeds</title>
<link>https://machinefossil.net/blog/posts/20210709/index.html</link>
<description>Here is an explanation of what RSS is.</description>
<guid>https://machinefossil.net/blog/posts/20210709/index.html</guid>
</item>
<item>
<title>Linux Terminal Games and Easter Eggs</title>
<link>https://machinefossil.net/blog/posts/20201203/index.html</link>
<description>Here are some fun programs and Easter Eggs.</description>
<guid>https://machinefossil.net/blog/posts/20201203/index.html</guid>
</item>
</channel>
</rss>
Steps To Create A RSS Feed For Your Own Site
-
Create a file named
feed.xmlin the root of your site directory (e.g. in/var/www/example.com/feed.xml). - At the top of the file, you need to put the tags that specify the version of XML and RSS being used (1.0 and 2.0, respectively), as seen above.
-
The
channelelement contains all of the actual feed content. Inside that, start with atitleelement with the title of your site. Then provide alinkelement with the URL of your site, and adescriptionelement with a sentence describing what your site is about. -
Then, each
itemelement will be a "notification" in the RSS feed.-
At minimum, each needs a
title(if the feed is for a blog, put the title of the post here), alinkcontaining the URL of the item (e.g. the URL of the blog post), and adescription(I'd put a few sentences from the first paragraph of the blog post). -
Each
itemalso needs aguid, which contains some sort of unique string to identify the element. It's fine to just use the link to the page again; by default, it's assumed that theguidis the "permalink" to the page (if it's not, setisPermaLink="false"in the tag, like in the line below, to avoid RSS readers attempting to treat the text as a link).<guid isPermaLink="false">machinefossil.net-blog-20201203</guid>
-
At minimum, each needs a
-
Finally, after the last
item, don't forget to close thechannelandrsstags.
That's all the required content, but there are some other tags that you may want to also include.
For example, adding a pubDate element inside an item
can be used to tell the RSS reader when a given blog post was published.
An example is below.
<item>
<title>Linux Terminal Games and Easter Eggs</title>
<link>https://machinefossil.net/blog/posts/20201203/index.html</link>
<description>Here are some fun programs and Easter Eggs.</description>
<guid>https://machinefossil.net/blog/posts/20201203/index.html</guid>
<pubDate>03 Dec 2020 16:30:55 -0600</pubDate>
</item>
To troubleshoot feed.xml, it can be helpful to use a RSS validator, such as
the one provided by W3C,
which checks the file for spec compliance and can point out any problems.
This article is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.