Introducing an RSS Feed
I’ll keep this brief since it’s not particularly interesting: I’ve added an RSS feed. Behind the
scenes, I wrote a small program that walks my directory structure and spits out a static file, so
the only caveat is that I’ll need to remember to run go:generate before publishing. While
standards can always be a bit intimidating, I can make a lot of assumptions since there are no
stakes, resulting in a very simple process:
- Recurse the
pagesdirectory. - Reverse sort by file path, excluding the first two path segments (
pages/<category>). Since I use YYYY/MM/DD in the file path, lexographically sorting this way gives us a nice reverse-chronological list. - Parse the first
h1markdown header to extract the title. - Parse for the first line starting with a capital letter to get the first line of actual content. I hard-wrap my text at 100 characters, so the literal line length is never very long.
- Extract the date from the path (EZPZ).
- Dump out an XML file using
encoding/xml. There are some idiosyncrasies, but overall it’s not too bad, especially compared to the wartier parts of Go’s standard library.
The only information that can’t be inferred is author, site title, and host, but I just added some
CLI flags to inject these. I could probably shoehorn this entire functionality into qsite itself
at some point, but I’d like to keep the assumptions inside of qsite slim for now. The very static
file structure can be restrictive, but it’s what makes it so easy to externally add functionality
like this.
For my audience of one whole reader, I hope this is appreciated!