CyberSecurity // Azure // Frontend // Svelte // Cloud Native // Software // CyberSecurity // Azure // Frontend // Svelte // Cloud Native // Software

Creating a rss feed

Cover for Creating a rss feed

Creating a RSS feed

Recently I added a RSS feed to my personal blogging site. RSS (RDF Site Summary) is a web feed technology, allowing programs to get updates from websites in a standardized fashion. Applications (called aggregators) can collect updates from different RSS sources, and display them in a custom newsfeed. RSS is mostly used for websites that update frequently such as blogs, podcasts and news sites.

RSS Logo

Image: RSS Logo

What is RSS

When queried, a RSS feed displays channels containing generic items. This data is provided as a XML file, which then can be read by appropriate applications. Below code snippet is an example of a RSS feed with one channel, containing 2 items:

// XML //

Channels

The RSS tag contains channels. Each channel contains multiple items, as well as a bit of general information. The following 3 tags are required for a channel, here filled in with a made-up developer news channel:

// XML //

Items

Now if we want to do anything useful with RSS feed, we need to publish some items. An item is a child element of a channel and only needs a required title or description like so:

// XML //

Many other elements can be added to channels and items to include more information. An entire list with useful examples can be found at The RSS Specification .

Generating in Svelte

Since this blog is created using Svelte, I generate the RSS feed on the fly making use of an Sveltekit API endpoint . The source code for this endpoint can be viewed here on Github .

// JAVASCRIPT //

I use the following headers to indicate that the request serves a XML file.

// JAVASCRIPT //

Conclusion

All in all, RSS is a great technology that is (in my opinion) really under-used. Aggregators availability and browser support for RSS has really shrunk over the past decade. In a time where the battle for an open internet is more relevant than ever (looking at you, Twitter) RSS seems like a great technological standard to allow automatic distribution of website updates.