alexkarle.com

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

use-feeds.7 (4683B) [raw]


      1 .Dd February 9, 2021
      2 .Dt USE-FEEDS 7
      3 .Os
      4 .Sh NAME
      5 .Nm use-feeds
      6 .Nd RSS/Atom feeds; what are they and why you should care
      7 .Sh SYNOPSIS
      8 .Bd -literal -offset indent
      9 Feed the birds
     10 Tuppence, a bag
     11     ~ Mary Poppins
     12 .Ed
     13 .Sh DESCRIPTION
     14 I've always wanted this site to be an homage to tech that I
     15 enjoy using, and recently, that's included old-school RSS/Atom feeds.
     16 However, up until now, I had only been a feed consumer
     17 and had never produced my own.
     18 So, this past weekend I decided to hunker down and read enough
     19 of the spec to generate one for this site.
     20 .Pp
     21 But let's back up \(em what is a feed? Why should you care?
     22 .Pp
     23 A feed is simply a standardized listing of items a source
     24 (blog, vlog, newspaper, etc) has generated recently.
     25 Users then consume multiple feeds to get centralized notifications
     26 on new content.
     27 Think "following" on social media, but generalized for any content
     28 accessible on the web.
     29 .Pp
     30 The most important feature of a feed is that it has been standardized
     31 and is not controlled by any individual corporation.
     32 This ensures that users are not only free from vendor lock-in, but
     33 it also allows for an increasingly diverse set of clients and sources.
     34 .Pp
     35 For example, there are clients ranging from FOSS text only terminal
     36 clients like
     37 .Xr newsboat 1
     38 to commercial apps like
     39 .Lk https://feedly.com Feedly .
     40 And despite being drastically different UI's, their purpose is the same:
     41 allow you to subscribe to any number of feeds, and centralize your
     42 notifications.
     43 .Pp
     44 The idea is simple, but it's transformed the way I interact with the
     45 web.
     46 It saves me time in not browsing the infinite scroll that has
     47 become social media, and it allows me to stay up to date with smaller
     48 blogs that don't post frequently (cough, like yours truly, cough).
     49 .Pp
     50 Consider a new blog post on this site.
     51 Without a feed, you'd have to periodically check my
     52 .Xr blog 7
     53 for updates
     54 or hear about it through some other link aggregation or social media
     55 site (Hackernews, Reddit, etc).
     56 Adding a feed allows those who want to follow to get notifications, without
     57 checking other locations or having to waste time checking back periodically.
     58 .Pp
     59 So if you haven't tried a feed reader ever, go find one that suits
     60 your fancy and give it a try!
     61 In an era where user upvoted content reigns king (Reddit, Facebook, etc),
     62 it's really empowering as a user to decide
     63 .Em what
     64 you see updates for and to be able to check them on your own time.
     65 And if you're a publisher of any content, consider creating a feed for
     66 others to follow.
     67 I'll certainly appreciate it!
     68 .Pp
     69 It's never too late to take control of your digital habits,
     70 and using a feed reader is a good place to start.
     71 .Sh IMPLEMENTATION
     72 If you read this far, I thought you might also be interested in hearing
     73 not only the what and the why but also the
     74 .Em how .
     75 .Pp
     76 Due to the recent migration to using
     77 .Xr mdoc 7
     78 as the markup for this site (detailed in
     79 .Xr my-old-man 7 ) ,
     80 I knew that finding an off-the-shelf feed generator would be unlikely.
     81 Plus, with my general desire to keep the site build-able by base OpenBSD,
     82 I figured it was as good an excuse as any to read the spec and generate
     83 it myself.
     84 .Pp
     85 I ended up choosing Atom over RSS mostly based on some online opinions
     86 that it is a stricter standard, but I can't say much to back that up.
     87 What I can say is that after the initial confusion of how to escape the
     88 embedded HTML in the XML feed, it was pretty smooth sailing.
     89 .Pp
     90 The full implementation is in
     91 .Lk https://git.alexkarle.com/alexkarle.com/file/bin/genatom.sh.html genatom.sh
     92 and basically boils down to:
     93 .Pp
     94 .Bl -enum -compact
     95 .It
     96 .Xr grep 1
     97 call through the
     98 .Em blog.7
     99 file to get a list of entries and their dates
    100 .It
    101 Print the header of the XML (with newest date from 1.)
    102 .It
    103 For each item in entries, add the XML entry along with the content
    104 as generated by
    105 .Xr mandoc 1
    106 with the
    107 .Fl O Ar fragment
    108 option.
    109 This ensures the "notification" has the full post \(em
    110 users never even need to visit the site!
    111 .It
    112 End by printing the footer of the XML
    113 .El
    114 .Pp
    115 And that's it!
    116 The only real trick was to use
    117 .Lk https://en.wikipedia.org/wiki/CDATA CDATA
    118 sections around the entry content in the XML to escape the HTML tags.
    119 .Pp
    120 And of course, like everything else in this blog, it rebuilds on git-push
    121 via a call to
    122 .Xr make 1 .
    123 See the
    124 .Lk https://git.alexkarle.com/alexkarle.com/file/Makefile.html Makefile
    125 for the recipe.
    126 .Sh SEE ALSO
    127 .Bl -bullet -compact
    128 .It
    129 .Xr blog 7
    130 .It
    131 My Atom feed:
    132 .Lk https://alexkarle.com/atom.xml
    133 .It
    134 Wiki page on Atom:
    135 .Lk https://en.wikipedia.org/wiki/Atom_(Web_standard)
    136 .It
    137 Atom RFC:
    138 .Lk https://tools.ietf.org/html/rfc4287
    139 .It
    140 Related advocacy:
    141 .Lk https://atthis.link/blog/2021/rss.html
    142 .El