willem.com
share this on: Facebook Twitter Pinterest Share

Increase traffic to your blog with a RSS feed

How to setup RSS/Atom using NodeJS

Oct. 31, 2020 -

Writing for my blog has been a lot of fun, I receive messages from all of the world about the things I like. Traffic is growing, every month more readers are finding their way to my blog. This week I received a request to support RSS feeds on my blog. I wondered, are RSS feeds still relevant today?

RSS Feeds

With RSS (or "really simple syndication") users and applications can access updates to websites in a standardised and computer-readable format. This allows them to combine updates from many different websites into a single news aggregator, basically like a personalised "newspaper".

Before social media became hugely popular, RSS feeds where widely used to share links and content between different news and blogging sources. Subscribing to a website's feed is similar to "following a thing" on social media, you'll automatically receive updates.

The great thing about RSS is that it is distributed, there is no single authority (or big corporation) that controls the content or the platform.

Decline of RSS usage

As social media has surpassed RSS feeds in popularity, support for RSS has been declining. Platforms such as Twitter and Facebook, allow single, simple, users to share content. This is far easier than setting up a blog with a corresponding RSS feed. The bulk of social media content is then moderated and filtered through algorithms, coupled with advertising, to be turned into a money generating mass media platform.

Resurrection of the e-mail newsletter

When Google Reader closed its doors, some bloggers lost 6.500 RSS subscribers overnight! If you think about maintaining contact with your audience, email makes sense. For most of us, email is interwoven with our daily routines. We check it regularly and have access to our mail from our mobile devices. If done properly, sending out email newsletters is a viable way to stay in touch with your audience. Heck, it's no surprise that people describe this to be a news media renaissance.

Why still use RSS feeds?

In the era of social media and newsletter resurrections one may wonder why you would still support RSS feeds? I think the main reason is that it takes very little effort to do it right, and it (still) provides value.

People, but perhaps more importantly, computers can use RSS feeds to automatically fetch updates from your blog. Popular newsletter software can use RSS to automate the newsletter creation process. By supporting RSS on your blog, you'll make it easier for others to send newsletters for you.

Did you know that other people use RSS feeds to automatically tweet about your content using modern services like IFTTT (if this then that)? You should check out this article. In short, RSS is a great way to support content automation. Even if you don't intend to do this, you should consider supporting others with their efforts by supporting RSS.

Same goes for software like narrow casting (or digital signage), where headlines can be automatically fetched from your website. RSS feeds are widely supported by digital signage software to generate news tickers.

With modern RSS reader apps like Feedly normal users can overcome many of the problems of the original RSS reader apps: overwhelming information overload. At this moment they serve a niche as they are less popular than social media, but this niche can be an important one (quantity vs quality). Perhaps one day there will be a RSS-feed renaissance, just like the email newsletters.

Modern RSS reader apps offer advanced features to filter and organise different feeds - making you like a ZEN information overload master .... of sorts
Modern RSS reader apps offer advanced features to filter and organise different feeds - making you like a ZEN information overload master .... of sorts

Adding RSS support to your blog

If you're blogging with popular blogging software, like WordPress, chances are that you already have RSS support build in. Try adding "/feed" to your blog's address, it may pop up automatically. Good for you! If you're using custom blogging software, like I do, you may need to implement RSS feeds yourself.

Implementing RSS support yourself

Technically, RSS is nothing more than a dialect of XML. It is a file that contains your content in a standardised, structured way. The RSS specification is open and holds very little secrets as it is well documented.

This blog is managed using custom software that I developed for my customers. My software generates so called "static HTML pages" from a dynamically managed back-end that runs on NodeJS. This means that I needed to find a way to generate the RSS feeds from my static site generator, along with the HTML files. Now, it's time to get technical! :-)

The popular NodeJS module
The popular NodeJS module "feed" makes content syndication simple and intuitive

It is always a good idea to check out existing implementations of open standards before you'll set out to "reinvent the wheel". Chances are that somebody already did all the hard work. But moreover, choosing a well tested package over a self built implementation (with undiscovered bugs and flaws) can be smart thing to do. For NodeJS there is the "Feed" module that makes it easy to generate RSS, Atom and JSON feeds.

Implementing RSS, Atom and JSON feeds on my blog using NodeJS and the Feed module
Implementing RSS, Atom and JSON feeds on my blog using NodeJS and the Feed module

Using the Feed-module I added a function to my static site generator called "generateFeeds()" that implements the code necessary to generate RSS, Atom and JSON feeds. Its main function is to map the different fields as specified in the RSS feed structure to those of my website's object model. Its not hard to get right if you already have a descent object model with references to to fields like an image URL, a post's title and publishing date.

Configuring NGINX to redirect common feed URL's to the generated RSS files
Configuring NGINX to redirect common feed URL's to the generated RSS files

I figured that it would be a good idea to setup my webserver, NGINX, to automatically redirect common feed URL's to the generated RSS files. This way my custom RSS-implementation is easier to discover by other people and computers; as it mimics behaviour of popular blogging software.

You can check out the result yourself, by using any of the following URL's:

Conclusion

Sometimes it makes sense to have a second look at yesteryear's technology. While RSS feeds may not be as popular as they once were, they can still provide value to your blog.

As implementing an RSS feeds is easy and maintaining it can be fully automated, there is really no reason why you should not consider adding it to your blog. As a bonus you'll be ready for the next renaissance!

Did you enjoy this post?

If you found this content useful,
consider showing your appreciation
by buying me a coffee ❤️😋:

Or help me by sharing this post with your friends:

Other stories

all CloudCreatingNetworkingProgrammingWebdesign