Source for
git clone git://
Log | Files | Refs | README | LICENSE

commit 623d08c7805a4e0eee9d56db5eaed3204dfbc59d (patch)
parent abca4ee462308eb0138fee57f864b8db500911a0
Author: Alex Karle <>
Date:   Wed, 10 Feb 2021 00:20:57 -0500

use-feeds: Add new post on RSS/Atom feeds

Adding an Atom feed wasn't sufficient to curb my enthusiasm for this
piece of (old) tech, so I wrote a blog post advocating for it (and
detailing my adventures in implementing it, of course!) :)

Mblog.7 | 3+++
Ause-feeds.7 | 140+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/blog.7 b/blog.7 @@ -14,6 +14,9 @@ feed (for use with your favorite RSS/Atom client). From newest to oldest: .Bl -bullet -compact .It +.Xr use-feeds 7 +- RSS/Atom feeds; what, why, and how (02/09/2021) +.It .Xr my-old-man 7 - Adventures in using .Xr mdoc 7 diff --git a/use-feeds.7 b/use-feeds.7 @@ -0,0 +1,140 @@ +.Dd February 9, 2021 +.Dt USE-FEEDS 7 +.Os +.Sh NAME +.Nm use-feeds +.Nd RSS/Atom feeds; what are they and why you should care +.Sh SYNOPSIS +.Bd -literal -offset indent +Feed the birds +Tuppence, a bag + ~ Mary Poppins +.Ed +.Sh DESCRIPTION +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. +.Pp +But let's back up \(em what is a feed? Why should you care? +.Pp +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. +.Pp +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. +.Pp +For example, there are clients ranging from FOSS text only terminal +clients like +.Lk newsboat(1) +to commercial apps like +.Lk 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. +.Pp +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). +.Pp +Consider a new blog post on this site. +Without a feed, you'd have to periodically check my +.Xr 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. +.Pp +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 +.Em 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! +.Pp +It's never too late to take control of your digital habits, +and using a feed reader is a good place to start. +.Sh 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 +.Em how . +.Pp +Due to the recent migration to using +.Xr mdoc 7 +as the markup for this site (detailed in +.Xr 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. +.Pp +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. +.Pp +The full implementation is in +.Lk +and basically boils down to: +.Bl -enum -compact +.It +.Xr grep 1 +call through the +.Em blog.7 +file to get a list of entries and their dates +.It +Print the header of the XML (with newest date from 1.) +.It +For each item in entries, add the XML entry along with the content +as generated by +.Xr mandoc 1 +with the +.Fl O Ar fragment +option. +This ensures the "notification" has the full post \(em +users never even need to visit the site! +.It +End by printing the footer of the XML +.El +And that's it! +The only real trick was to use +.Lk CDATA +sections around the entry content in the XML to escape the HTML tags. +.Pp +And of course, like everything else in this blog, it rebuilds on git-push +via a call to +.Xr make 1 . +See the +.Lk Makefile +for the recipe. +.Sh SEE ALSO +.Bl -bullet -compact +.It +.Xr blog 7 +.It +My Atom feed: +.Lk +.It +Wiki page on Atom: +.Lk +.It +Atom RFC: +.Lk +.It +Related advocacy: +.Lk +.El