A solution to one RSS inconsistency

2020-06-01

RSS feeds are a beautiful and wonderful open standard that anyone can, and should, utilise on their blogs, websites, or anything else. The standards RSS follows are reasonably flexible, but there is another aspect to RSS that is incredibly inconsistent across all use cases. That inconsistency is the location of the RSS feed file and the name of that file.

A common idea seems to be putting a file after the domain root, though there is very little consensus on what this file should be called. Whilst feed.xml is certainly popular, I've seen atom.xml, posts.xml, feed.atom and rss.xml.[1] Additionally, websites which have blogs located in a subfolder of the site, such as, commonly, /w or /writing will generally, though not always, have the feed be in that folder and not in the site index.

Looking at the big corporations. WordPress blogs can find their RSS feeds at /feed, which is a technique a fair few personal blogs employ as well[2] and this is the system other blogger platforms use, such as dev.to. Meanwhile, Reddit has feeds all over the place - every user, subreddit, or post has a feed associated with it which you can find by adding /.rss to the URL.

Its impossible to list all the possible varieties, and I've only just scatched the surface. I highly recommend you read through the responses to this hacker news post, where hundreds of people have shared their blogs, to find yet more interesting instances of RSS implementation.

It's very apparent that there is no standardisation as to where and how you should place your RSS feed in your site structure, which is an issue that might potentially cause confusion for visitors to your website. The solution I've used for this website is to place redirects everywhere a potential user might look for an RSS feed. These redirects point to a single atom.xml file. Below is the gulp task which does this.

var rssStrings = [ 'atom', 'feeds', 'feeds.xml', 'feed.xml', 'rss', 'rss.xml' ]; gulp.task('rss', function() { let tasks = []; for (let i in rssStrings) { tasks.push( gulp.src("dist/feed/**") .pipe(rename(function(path) { path.dirname = rssStrings[i]; })) .pipe(gulp.dest("./dist")) ); } return mergeStream(tasks); });

Where dist/feed/** points an HTML file which provides a redirect to the atom.xml which contains the feed. Potentially, you could also copy the atom file itself, instead of a redirect. But I decided I'd rather ensure that there is only one atom file I need to worry about. Using this method, access to the RSS file is as available as possible.

Footnotes

  1. A few examples: writing.markchristian.org, paulstamatiou.com, xkcd.com, what-if.xkcd.com, rachelbythebay.com/w/
  2. A few examples: tkainrad.dev, extremelearning.com.au, walkedtheblueline.com, caribbeansignal.com

As an aside, I also saw one instance (paul.copplest.one) where the RSS feed was a link to the GitHub commits feed, which I suppose is innovative in its own sort of way.