RSS/Atom feeds; what are they and why you should care

Published: February 9, 2021

I've always wanted this site to be an homage to tech that I enjoy using, and recently, that's included old-school RSS/Atom feeds. However, up until now, I had only been a feed consumer and had never produced my own. So, this past weekend I decided to hunker down and read enough of the spec to generate one for this site.

But let's back up -- what is a feed? Why should you care?

A feed is simply a standardized listing of items a source (blog, vlog, newspaper, etc) has generated recently. Users then consume multiple feeds to get centralized notifications on new content. Think "following" on social media, but generalized for any content accessible on the web.

The most important feature of a feed is that it has been standardized and is not controlled by any individual corporation. This ensures that users are not only free from vendor lock-in, but it also allows for an increasingly diverse set of clients and sources.

For example, there are clients ranging from FOSS text only terminal clients like newsboat(1) to commercial apps like Feedly. And despite being drastically different UI's, their purpose is the same: allow you to subscribe to any number of feeds, and centralize your notifications.

The idea is simple, but it's transformed the way I interact with the web. It saves me time in not browsing the infinite scroll that has become social media, and it allows me to stay up to date with smaller blogs that don't post frequently (cough, like yours truly, cough).

Consider a new blog post on this site. Without a feed, you'd have to periodically check my blog(7) for updates or hear about it through some other link aggregation or social media site (Hackernews, Reddit, etc). Adding a feed allows those who want to follow to get notifications, without checking other locations or having to waste time checking back periodically.

So if you haven't tried a feed reader ever, go find one that suits your fancy and give it a try! In an era where user upvoted content reigns king (Reddit, Facebook, etc), it's really empowering as a user to decide what you see updates for and to be able to check them on your own time. And if you're a publisher of any content, consider creating a feed for others to follow. I'll certainly appreciate it!

It's never too late to take control of your digital habits, and using a feed reader is a good place to start.

Implementation

If you read this far, I thought you might also be interested in hearing not only the what and the why but also the how.

Due to the recent migration to using mdoc(7) as the markup for this site (detailed in my-old-man(7)), I knew that finding an off-the-shelf feed generator would be unlikely. Plus, with my general desire to keep the site build-able by base OpenBSD, I figured it was as good an excuse as any to read the spec and generate it myself.

I ended up choosing Atom over RSS mostly based on some online opinions that it is a stricter standard, but I can't say much to back that up. What I can say is that after the initial confusion of how to escape the embedded HTML in the XML feed, it was pretty smooth sailing.

The full implementation is in genatom.sh and basically boils down to:

  1. grep(1) call through the blog.7 file to get a list of entries and their dates
  2. Print the header of the XML (with newest date from 1.)
  3. For each item in entries, add the XML entry along with the content as generated by mandoc(1) with the -O fragment option. This ensures the "notification" has the full post -- users never even need to visit the site!
  4. End by printing the footer of the XML

And that's it! The only real trick was to use CDATA sections around the entry content in the XML to escape the HTML tags.

And of course, like everything else in this blog, it rebuilds on git-push via a call to make(1).

See Also

Back to blog