Skip to Content
Fumadocs

RSS Feed

Generate a RSS feed for your docs/blog.

Setup

You can create the feed object:

lib/rss.ts
import { Feed } from 'feed';
import { source } from '@/lib/source';

const baseUrl = 'https://fumadocs.dev';

export function getRSS() {
  const feed = new Feed({
    title: 'Fumadocs Blog',
    id: `${baseUrl}/blog`,
    link: `${baseUrl}/blog`,
    language: 'en',

    image: `${baseUrl}/banner.png`,
    favicon: `${baseUrl}/icon.png`,
    copyright: 'All rights reserved 2025, Fuma Nama',
  });

  for (const page of source.getPages()) {
    feed.addItem({
      id: page.url,
      title: page.data.title,
      description: page.data.description,
      link: `${baseUrl}${page.url}`,
      date: page.data.lastModified ?? new Date(),

      author: [
        {
          name: 'Fuma',
        },
      ],
    });
  }

  return feed.rss2();
}

Then serve it from a route:

src/routes/rss[.]xml.ts
import { createFileRoute } from '@tanstack/react-router';
import { getRSS } from '@/lib/rss';

export const Route = createFileRoute('/rss.xml')({
  server: {
    handlers: {
      GET: async () => new Response(getRSS()),
    },
  },
});

Link it from your pages, so feed readers can discover it:

src/routes/__root.tsx
export const Route = createRootRoute({
  head: () => ({
    links: [
      { rel: 'alternate', type: 'application/rss+xml', title: 'Fumadocs Blog', href: '/rss.xml' },
    ],
  }),
  // ...
});

How is this guide?

Last updated on