Docs, Blog & Legal Content

Author documentation, blog posts, and legal pages with Fumadocs MDX.

The template compiles documentation, blog posts, and legal pages from MDX with Fumadocs. Collection schemas live in source.config.ts; application loaders turn generated modules into serializable route data and lazy-rendered content.

Content map

source.config.ts

The template includes a ready-to-customize documentation site for your product. Its starter navigation groups pages into introduction, essentials, and components; replace, rename, or reorganize these sections to match your SaaS. Each meta.json controls the title and page order for its directory. Add a filename to pages only after the referenced MDX file exists.

Documentation

defineDocs({ dir: "content/docs" }) defines the collection. src/lib/source.ts loads MDX and metadata with Vite globs, configures Fumadocs for English/Chinese, and builds locale-aware paths. _docs.tsx serializes the page tree in a createServerFn; _docs/docs/$.tsx resolves the catch-all page, preloads its MDX module, supplies Fumadocs components, and builds SEO.

Default-language pages use slug.mdx; Chinese pages use slug.zh.mdx. The template currently demonstrates the pair on introduction/quick-start; most other docs pages are English-only, so complete the pairs before claiming fully bilingual documentation.

---
title: API Overview
description: Learn how the product API is organized.
icon: Braces
---

## Authentication

Explain the endpoint here.

Add api-overview.mdx and api-overview.zh.mdx, then place "api-overview" in the relevant meta.json.

Blog

source.config.ts requires title and date; description, author, tags, and image are optional. src/lib/blog.ts loads posts, sorts newest first, derives slugs from paths, paginates six per page, and builds a tag list (up to ten tags, ordered by frequency then name).

---
title: Shipping the First Release
description: What changed and how to upgrade.
date: 2026-06-24
author: Example Team
tags: [Release, Product]
image: /screen/release.png
---

Write the post here.

_marketing/blog/index.tsx validates tag and page search parameters and loads the filtered list. _marketing/blog/$slug.tsx loads one post, renders its TOC and metadata, and returns not found for an unknown slug.

Legal frontmatter requires title and date; description is optional and published defaults to true.

---
title: Acceptable Use Policy
description: Rules for using the service.
date: 2026-06-24
published: true
---

src/lib/legal.ts excludes unpublished pages from direct lookup and sitemap enumeration. _marketing/legal/$slug.tsx renders the page and TOC. Update legal copy, dates, links, and jurisdiction with qualified advice for your product.

Localization boundary

Docs understand localized filename suffixes. Blog and legal loaders currently use one shared collection for both /... and /zh/...; translated route chrome does not create translated article bodies. If those collections must be bilingual, add a locale field or filename convention to their schemas/loaders, select content by route locale, and emit correct SEO alternates.

Generated files and build

The fumadocs-mdx Vite plugin reads source.config.ts and generates typed modules in .source. That directory is included by TypeScript but gitignored; do not hand-edit or commit it. If generated imports become stale, stop the dev server, remove the generated cache if necessary, and rerun pnpm dev or pnpm build.

Verify

  • New docs pages appear in the intended meta.json order in both locales.
  • Missing locale variants have an intentional fallback or are completed.
  • Blog posts sort by date, filter by tag, paginate, and render their TOC/SEO.
  • published: false legal pages return not found and stay out of the sitemap.
  • Internal links use locale-aware application paths.
  • pnpm build regenerates .source and compiles every MDX module.

On this page