How to create an RSS feed for your site
.....but firstly, what the heck is RSS?!
RSS is basically a way to have a personalised, up to date feed from your favourite site. In essence, it will show you new posts from the site as soon as they're released.
RSS stands for Really Simple Syndication and the way it works is that you point your favourite RSS reader at an RSS feed url, and it shows you the latest posts for that site when they're released. Note that Firefox used to support this natively with something called live bookmarks up until 2018, but now you'd need to use an add-on like FeedBro, or another standalone RSS reader to get them.
(⬆ what live bookmarks looked like in Firefox)
How do you create an RSS feed for your own site?
So luckily for us, an RSS feed is actually a pretty simple format. It looks nearly identical to the sitemap.xml file I posted in my last blog post.
(courtesy of W3Schools XML RSS)
<rss version="2.0"> <channel> <title>W3Schools Home Page</title> <link>https://www.w3schools.com</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>https://www.w3schools.com/xml/xml_rss.asp</link> <description>New RSS tutorial on W3Schools</description> </item> <item> <title>XML Tutorial</title> <link>https://www.w3schools.com/xml</link> <description>New XML tutorial on W3Schools</description> </item> </channel> </rss>
If you look into each of the elements in the RSS feed you can see there's not much to it:
- A title, link, and description to describe the purpose of the RSS feed and where to find the site itself
- Then each item with a title, link, and description to show up in the RSS feed list (ie. a list of articles/news posts/comics)
All you have to do is host that XML file somewhere on your site, update it as you create new content (preferably automatically), and then as soon as you create a new article, everyone using the RSS feed will automatically be able to see the new article.
Since I'm already automatically generating a new sitemap.xml file every time I publish a new blog or comic, I'm going to be reusing that code and tweaking it slightly to create the RSS feed.
TEN MINUTES LATER... Voila!
I now have an RSS feed that you can plug into your favourite RSS reader 😁
I hope you found this useful!