1 min readMay 15, 2026by maintainer
Rendering Model
The document page route is src/app/(public)/docs/[...slug]/page.tsx. It turns a URL into a fully rendered documentation page.
Request flow
- The route receives the slug from
/docs/[...slug]. getDocBySlug()finds the matching.mdor.mdxfile.gray-mattersplits frontmatter from the Markdown body.validateFrontmatter()validates the metadata schema.- The current session is loaded.
checkAccess()decides whether the viewer can read the page.getAllDocs()andbuildNavTree()create the viewer-specific menu.getScopedNav()narrows the sidebar to the current section.MdxRendererrenders the Markdown and MDX body.- Page controls render around the body: metadata, breadcrumbs, table of contents, feedback, report issue, previous/next, progress bar, and scroll-to-top.
Markdown renderer
MdxRenderer uses:
next-mdx-remote/rscfor server-side MDX renderingremark-gfmfor GitHub-flavored Markdown tables, task lists, and strikethroughrehype-slugfor heading IDsrehype-autolink-headingsfor clickable heading anchorspreprocessAdmonitions()for MkDocs and Docusaurus-style callouts- Custom components such as
Admonition,CodeTabs,Collapsible,Protected,ExtensionGrid, andVideoEmbed
Page chrome
The app renders more than the Markdown body:
| Area | Source |
|---|---|
| Browser metadata | Frontmatter plus breadcrumb titles |
| Sidebar | buildNavTree() and getScopedNav() |
| Breadcrumbs | Current slug segments |
| Video block | video frontmatter field |
| Deprecation banner | status: deprecated |
| Table of contents | Rendered headings in the page |
| Feedback and issue links | Authenticated client-tier users and above |
| Previous and next links | Current scoped sidebar order |
Rendering is access-aware
The same document can render as full content, a locked access page, or a 404 depending on the viewer and the page's access tier.
Rendering a section grid
This page is part of the rendering section. The grid below is rendered by the same MDX component available to your own docs: