Additional Features
RSS Feed
Generate a RSS feed for your docs/blog.
Setup
You can create the feed object:
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: new Date(page.data.lastModified),
      author: [
        {
          name: 'Fuma',
        },
      ],
    });
  }
  return feed.rss2();
}And expose it using a server loader/route handler like:
import { getRSS } from '@/lib/rss';
export const revalidate = false;
export function GET() {
  return new Response(getRSS());
}Next.js Metadata
You can add an alternates object to the metadata object with your feed’s title and URL.
import type { Metadata } from 'next';
export const metadata: Metadata = {
  alternates: {
    types: {
      'application/rss+xml': [
        {
          title: 'Fumadocs Blog',
          url: 'https://fumadocs.dev/blog/index.xml',
        },
      ],
    },
  },
};How is this guide?
Last updated on
