I forgot RSS feeds existed...

That is, I’ve been familiar with Really Simple Syndication for many years (I remember writing my own RSS aggregator in PHP about 20 years ago, but don’t ask me what happened to it.) Yet today, in the walled-garden of social media (to which we have become accustomed) the popularity of RSS has faded. Without realising it, I no longer didn't even have an RSS reader installed...

The thing is: when everyone's content is controlled by the same, big firm you don't actually "need" a decentralised, open, and free method of keeping up with cool and interesting stuff. These days, the big social media firm just gives you a timeline of their stuff and you don’t ever look at anything else. Even the mighty hyperlink is a supporting player in the piece (upon which I’m sure I’ll elaborate later...)

This note is about bringing back RSS!

"RSS feeds" are a simple (and free) way for web sites to publish lists of new articles and updates. You can subscribe to any of these lists with no account and without giving them your email address. It’s basically an inbox that downloads updates from blogs.

Subscribe to my RSS feed. All you need is an app called an RSS reader, and then start looking out for those little orange feed icons dotted around the web!

I’m currently using Feeder (open source, android) to read RSS feeds but there are loads of other options available. (You can even write your own code to fetch RSS feeds.)

subscribe


Guides

RSS tools


My RSS implementation

Shortly into my Neocities journey I noticed quite a few people are still adding the old-fashioned orange RSS icons on their web sites:

At first I dismissed it as a throwback to the old web... But at the same time I'm vaguely wondering: how people on this new "indie" web thingy are interacting with each other? (Without just moving the whole conversation onto social media, which sort of defeats the point!)

Looking around, a lot of static web sites are using guest books (to allow visitors to leave comments), and an "updates" section (if not, an actual blog) to tell their visitors what's new. So I eventually hurriedly added both of these features to my own site. That's great, but still: you never know when a website updates unless someone tells you!

And then someone said something, upon which the scales fell from my eyes:

...got this on my rss feed and...

Whaaat!? people are still using RSS! Not only that, but it’s... it’s... useful. I need to get me an RSS reader and start subscribing to some web sites! Not only that, but I also need to publish my very own RSS feed so I can try to fit in with the cool kids... simple.

Valid RSS OK, so to get started: I know how to implement an RSS file, it’s just flat XML. That’s the easy part.

But my web site isn’t a blog; I don’t really write "articles". I’m more of the web gardener or living document type, where things just grow and I either nurture them or cut them back. So what content do I put in the feed? No problem: ive already got my "updates panel" going on the home page, so let's treat that as a sort-of proper micro-blog, and syndicate that.

Cool, so: just make an RSS file that contains the same stuff as the updates section.

Sounds easy, what’s the problem?

Well for a start, I refuse to just manually create XML files duplicating the same text as my HTML pages: that’s way too much effort, even if I copy-and-paste everything it’s a fundamental no-no according to the DRY principle. I need to find a way to populate my HTML document and my XML file with the same content while only maintaining a single master copy of the information.

The next problem consideration: I use Neocities to host my web site, which is a static hosting provider. That means I can’t do anything useful dynamic like (say) write some simple server-side code to generate an RSS file containing all of my latest updates. Nope, everything has to be uploaded to Neocities as static files, they cant be generated on the fly.

One option (and what I believe most people would do in my situation) is to use a static site generator: software that would create the matching HTML and XML files "offline" and then upload these pre-built static files to the host. However, I’ve (for the foreseeable) pretty much ruled out using any sort of SSG on this site. It doesn't really match the unkempt, jury-rigged, manually-hacked-together-live ad-hoc, template-free development experience I’m looking for.

One of the Possible Solutions

how to build micro-blog (with rss)
(It's a lot simpler than it looks, trust me)

So let's have another look at what it needs to do. The RSS feed should must:

And the tools available are:

Now, I’ve already said that we I can’t use any kind server-side scripting or code generator. And RSS readers don’t support client-side scripting to generate a feed dynamically. So realistically the creation of the XML is going to have to happen manually, and delivery to the RSS reader statically.

However, another tool on the list is a web browser, which does allow some dynamic control of web pages after they've been downloaded from the server. Client-side, using JavaScript. In fact, JS can do loads of useful things, like load XML files into memory, and it just happens to be really good at manipulating the structure of HTML pages...

So all I need to do is:

  1. upload the static (manually created) XML file (RSS feed), and treat this as the master copy of the data
  2. use some JavaScript code to load the XML file into browser memory and insert the RSS data into the HTML page after it’s loaded.

Fair enough, I’m handy enough with JavaScript to make that work. Mind you, the last time I did anything like that I would have just used jQuery, and apparently we aren’t using jQuery anymore (and I’ve never had to load an XML file without it.)

While mulling all of this over, I found an article on css-tricks.com which would work. But then one of my new Neocities buddies, Polyducks reached out to me on social media (like you do) and said he wouldn't mind if I borrowed some JS code from his RSS-driven micro-blog 🙄 the news feed at 1bbb. Nice.

The key to the whole solution is JavaScript’s window.fetch(url). Then, parse the (XML) string response using some kind of DOM parser (DOMParser­.parseFromString works well for this.) It returns a Document object which exposes all the usual DOM-querying methods like querySelectorAll("item"). From there, depending on requirements, we can iterate through the RSS feed content and print out a pretty HTML version for our visitors!

It’s really simple.

Result:

(And yeah, I know it doesn't work without JavaScript enabled, but in this instance I’m fine with that. It’s good enough.)

RSS elsewhere