Coding Babble  Code it once more, with feeling.

Making Your Website RSS Compatible

By Luke Simpson

Introduction

RSS stands for Really Simple Syndication and provides a way for users to aggregate their favorite content (e.g., news, videos, podcasts, blogs) from across the web into one place, an RSS reader, and stay up-to-date more easily. Users can also organize their content how they like. In this post we’ll learn how to make our website RSS compatible.

Creating RSS XML

The first step is describing your site’s content in the RSS standard, which is a dialect of XML. In my case, this was generated for me automatically since I built this site with Hugo. You can view the RSS XML for this site here:

https://codingbabble.com/index.xml

Notice there is some channel info and list of items, which are my blog posts. The RSS version is 2.0, which has been around since 2002 and last updated in 2009.

channel represents the source (this site) and has three required elements, title, link, and description.

All elements for item are optional, but either title or description must be provided.

For more details about the spec, check out the RSS Advisory Board.

Adding RSS autodiscovery

A link to your XML file in the document <head> will allow RSS readers to find your feed more easily.

<link
  rel="alternate"
  type="application/rss+xml"
  href="https://codingbabble.com/index.xml"
  title="Coding Babble"
/>

A rel of alternate indicates an alternate representation of the current document. If you have a link to your feed in the <head>, some readers allow users to simply input the host, e.g. https://codingbabble.com, and it will find the feed automatically. Otherwise, they have to hunt for it since there is no standard place to put it.

You can also provide a visible link, either using an RSS icon,

RSS icon

or text that says something like “RSS Feed”. Make sure it links to your XML file, and users can simply right click it, copy the link, and paste it into their reader.

Conclusion

RSS feeds are falling somewhat out of favor with big companies, such as X (formerly Twitter) and Facebook. They would rather you spend all of your time on their sites, so you click their ads and so they can more easily track you. However, if you like the idea of giving users the freedom to curate and organize their own content, adding RSS compatibility is a great way to do that.

Support the blog! Buy a t-shirt or a mug!

Tags: