Toggle Settings and Themes
Site Preferences

*The preferences are saved using cookies because this website does not use Javascript.
To clear the cookies, select Clear Cookies and click submit, this will also reset all the preferences to default.
The cookies are not used for analytics, read the privacy policy for more details.

Serving RSS (Atom) and JSON Feeds

I now serve Atom and JSON feeds, a simple feature that I took too long to provide, here's how I did it.

This page was published on .

What took me so long to do this?

Serving an RSS feed for my website was in my TO-DO list for far too long, I was just waiting for the right push.
I always thought that nobody reads my blog posts.

About a month ago, I received 3 XMPP messages and an E-mail asking me for a feed to subscribe to, maybe they are the only people reading my blogs, who knows? Not me!

Anyway, I decided to add an Atom feed first instead of RSS, may be the name ticked me off a bit. Looking at the way I structured the project, it looked simple enough, so I managed to do it within an hour with just a few lines. Optimizing the logic, fixing bugs, and adding small features to it took a bit longer, so I did those over a few weeks whenever I got some spare time.

I now feel that it is good enough to be official, I now serve Feeds! I also have a special page to show you different feeds you can add to your feed reader.

How did I generate a Feed?

The way you generate the feed depends on how you host your website and serve it, do you just have some HTML files bundled in some folder that's being served? You probably have to do it manually or write a script to copy the contents to the feed file, this might also be the simplest approach one could take compared to what I did.

To serve a feed, I need to know what a feed requires. For a list of blogs, we will need: title, summary, and date. I also took last modified date, a banner-image, tags, and content of the blog.

In my project, all this information except the actual content is stored in a small JSON file, which I might move to an SQLite DB soon. The content is rendered to the page using the rust implementation of handlebars and rocket (a rust framework to build websites).

It was a bit tricky to figure out how to get the content to render as properly in the browser, but I after a lot of debugging, I found that I had it right the first time. The problem was a Firefox bug that caused the content to not render as HTML when I style it using an XSL file.

But it is not the end of the world, the feed still contains the complete content, it's just that I don't show it to you if you access the XML from a browser. A feed reader will be able to get the complete content without issues, you can also do a curl and see it for yourself curl -s | less

The next issue was the banner, I did not have a banner for all the blogs, and only a couple of projects have them. So I created a default banner which helps me add a banner image for every feed item but I only have it for the JSON feed at the moment.

Making the JSON feed was much easier as I already prepared everything for the atom feed, I just had to create a proper structure for it and bam! The JSON feed is ready to be consumed.

About me

Coding Otaku Logo

I'm Rahul Sivananda (he/him), the Internet knows me by the name Coding Otaku. I work as a Full-Stack Developer (whatever that means) in London.

I care about Accessibility, Minimalism, and good user experiences. Sometimes I write stories and draw things.

Get my cURL card with curl -sL
Find me on Mastodon, Codeberg, or Peertube.
Subscribe to my feeds.

Continue Reading



All my blogs can be subscribed to using RSS(Atom) or JSON feeds, if you do not know how to use feeds, I have a page with instructions on how to do that.


Note: All comments are held for moderation before publishing it!

The comments can be deleted if you have not cleared the cookies. If you clear the cookies and want your comment(s) to be deleted, please send me an email from the email address you submitted when commenting (I will also consider the email from your website domain).

Anonymous comments cannot be deleted if you clear the cookies as I have no way of knowing who commented.

The comment forum, a unique id will be stored as a cookie in your browser to save the session.

Recent Blogs

Subscribe via Atom or JSON feeds.