Fumadocs is a docs framework, but it's also a powerful tool to manage content in Next.js. You can use Fumadocs to build a blog site along with docs, on a single Next.js app.
By default, there should be a (home) route group with <HomeLayout /> inside.
Let's put the blog pages under it, this way we can get the nice navbar on our blog site.
app/(home)/blog/page.tsx
import Link from 'next/link';import { blog } from '@/lib/source';export default function Home() { const posts = blog.getPages(); return ( <main className="grow container mx-auto px-4 py-8"> <h1 className="text-4xl font-bold mb-8">Latest Blog Posts</h1> <div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3"> {posts.map((post) => ( <Link key={post.url} href={post.url} className="block bg-fd-secondary rounded-lg shadow-md overflow-hidden p-6" > <h2 className="text-xl font-semibold mb-2">{post.data.title}</h2> <p className="mb-4">{post.data.description}</p> </Link> ))} </div> </main> );}
Good to Know
Colors like text-fd-muted-foreground are from the design system of Fumadocs UI, you may also use your own colors, or use Shadcn UI.
And create a page for blog posts.
Note that blog posts won't have nested slugs like /slug1/slug2, we don't need a catch-all route for blog posts.