NextJS
2 min read
25.12.2025

Adding an RSS Feed to My Next.js Blog

Last updated: 25.12.2025

RSS feed illustartion
🎧

Audio Narration

Listen to this post

The blog has introduced a comprehensive RSS feed using Next.js App Router and Sanity's content API, offering a standards-compliant RSS 2.0 feed with enhanced features. The feed includes full post metadata, author attribution, category tags, image and audio enclosures, and auto-generated summaries. It is generated server-side via a Next.js API route and queries published posts from Sanity, ensuring consistency with the site. Key technical aspects include XML escaping, aggressive caching, RSS 2.0 compliance with extended namespaces, auto-discovery via HTML metadata, and error handling. RSS remains relevant due to reader control, privacy, platform independence, and lack of algorithmic filtering. Readers can subscribe using any RSS reader by visiting the provided URL, receiving updates with text and audio narration for each article. This feature enhances accessibility and respects reader privacy.

I just added a fully-featured RSS feed to my blog, making it easy for readers to subscribe and stay updated on new posts. The implementation leverages Next.js App Router and Sanity's content API to generate a standards-compliant RSS 2.0 feed with extended features.

What's in the Feed

The RSS feed includes everything you'd expect from a modern feed:

  • Full post metadata including title, description, and publication dates
  • Author attribution using Dublin Core namespace
  • Category tags for easy filtering
  • Image enclosures for featured images
  • Audio enclosures for TTS narration
  • Auto-generated summaries in the description field

Technical Implementation

The feed is generated server-side using a Next.js API route at /posts/rss.xml. It queries all published posts from Sanity using the existing allPostsQuery, ensuring consistency with what's displayed on the site.

Key implementation details:

  • Proper XML escaping to prevent injection attacks
  • Aggressive caching (1 hour with stale-while-revalidate) to minimize server load
  • RSS 2.0 compliance with extended namespaces (Dublin Core, Atom, Content Module)
  • Auto-discovery via HTML metadata in the site layout
  • Graceful error handling with fallback empty feed

Why RSS Still Matters

Despite the rise of social media and email newsletters, RSS remains relevant for several reasons:

  • Reader control: Subscribers choose when and how to consume content
  • Privacy: No tracking or data collection
  • Platform independence: Works with any RSS reader
  • No algorithmic filtering: Every post reaches every subscriber

The Result

Readers can now subscribe to the blog using any RSS reader (Feedly, Inoreader, NetNewsWire, etc.) by visiting https://andreskristensen.blog/posts/rss.xml. The feed automatically updates whenever new posts are published, and includes both text content and audio narration for each article.

This addition makes the blog more accessible and gives readers another way to stay connected—one that respects their time and privacy.