RSS and JSON feeds for Next.JS site

RSS and JSON feeds for Next.JS site

Hey!

You can now subscribe to this blog :)

Yeah, I planned to add this feature a long time ago, and finally, today, I got a couple of hours to do it. After some googling, I found JSON feed. I do not want to start the "FINALLY! THE RSS KILLER" thread, but I am happy because I do not like XML. It is wordy and not readable for me.

Newerless RSS feeds are widely supported, so this blog should provide a new and shiny JSON feed and an old and dusty RSS.

If you read the "How to serve sitemap.xml with Next.JS" post, then it should be familiar to you. Here are links to the source code of feed.json.tsx and feed.xml.tsx.

One significant difference is memoization. Since posts are immutable, we can remember the result of feed generation. I wrote a simple helper function for that. It is not a general-purpose memoization function because it will only work with a one-argument function and make only shallow comparisons. This is intentional and done for simplicity's sake. You can find the source code here utils/index.ts.

Here are the links for your feed reader:

Stay tuned!

More:

Image gallery with Cloudinary

Here's how I build an image gallery with Cloudinary

How to serve sitemap.xml with Next.JS

Quick guide with code and explanation on sitemap.xml with Next.JS

Typescript + Nextjs + Prismjs or the tale about code highlighting

How to make Prism JS work with typescript and NextJs