Files
vercel__workflow/docs/source.config.ts
Pranay Prakash 6fad87b2a4 docs: derive section landing-page cards from the page tree + lint drift (#2567)
Section index card grids (e.g. foundations) were hand-written and drifted
from the sidebar (meta.json) and the actual pages. Make them derive from
the fumadocs page tree (single source of truth) and add CI lint so the
card grid and navigation can't fall out of sync again.

- resolveSectionChildren + <AutoCards/>, bound in both v4 and v5 docs
  routes (correct /docs vs /v5/docs URL spaces)
- getLLMText expands <AutoCards/> so llms.txt/.md/copy-page keep child links
- manualCards frontmatter opt-out for curated pages (source.config.ts)
- checkSectionCards (card<->nav completeness) + checkMetaEntriesResolve
  (dangling meta entries) in scripts/lint.ts
- convert foundations + errors (drift fixes) and v5 observability to AutoCards
- mark deploying + ai as manualCards (intentionally curated)
- remove dangling meta entries: v4 cancellation (x2), root introduction
  (x2), v4/internal serializable-abort-controller

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:37:35 -07:00

82 lines
2.4 KiB
TypeScript

import { remarkMdxMermaid } from 'fumadocs-core/mdx-plugins';
import {
defineConfig,
defineDocs,
frontmatterSchema,
metaSchema,
} from 'fumadocs-mdx/config';
import lastModified from 'fumadocs-mdx/plugins/last-modified';
import { z } from 'zod';
const docsSchema = frontmatterSchema.extend({
product: z.string().optional(),
url: z
.string()
.regex(/^\/.*/, { message: 'url must start with a slash' })
.optional(),
type: z
.enum([
'conceptual', // Explains what something is and why it exists. Architecture, mental models, design decisions.
'guide', // Walks through how to accomplish a goal. Tutorials, getting started, workflows.
'reference', // Lookup-oriented, exhaustive details. API docs, config options, function signatures.
'troubleshooting', // Diagnoses problems and solutions. FAQs, errors, known issues, debugging guides.
'integration', // Connects multiple systems. 3rd-party setup, plugins, webhooks, migrations.
'overview', // High-level introductions. Landing pages, changelogs, release notes.
])
.optional(),
prerequisites: z
.array(
z.string().regex(/^\/.*/, {
message: 'prerequisites must start with a slash',
})
)
.optional(),
related: z
.array(
z.string().regex(/^\/.*/, { message: 'related must start with a slash' })
)
.optional(),
summary: z.string().optional(),
keywords: z.array(z.string()).optional(),
// Opt a section landing page out of the card↔nav completeness lint when its
// `<Cards>` grid is intentionally curated (e.g. links outside the section or
// deliberately omits children). Exhaustive list pages should use `<AutoCards />`
// instead, which derives cards from the page tree and can never drift.
manualCards: z.boolean().optional(),
});
// You can customise Zod schemas for frontmatter and `meta.json` here
// see https://fumadocs.dev/docs/mdx/collections
export const v4docs = defineDocs({
dir: 'content/docs/v4',
docs: {
schema: docsSchema,
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema,
},
});
export const v5docs = defineDocs({
dir: 'content/docs/v5',
docs: {
schema: docsSchema,
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema,
},
});
export default defineConfig({
mdxOptions: {
remarkPlugins: [remarkMdxMermaid],
},
plugins: [lastModified()],
});