Routing
Trellis Docs uses file-based routing — the file path under content/docs/ determines the page URL.
File-to-URL mapping
| File path | URL |
|---|---|
content/docs/getting-started.mdx | /getting-started/ |
content/docs/guides/deployment.mdx | /guides/deployment/ |
content/docs/theme/index.mdx | /theme/ |
content/docs/faq/general.mdx | /faq/general/ |
The rules:
- The
content/docs/prefix is stripped - The
.mdxor.mdextension is removed index.mdxfiles map to the directory path (e.g.guides/index.mdx→/guides/)
Dynamic route
Documentation pages are rendered by a single dynamic route at app/(docs)/[...slug]/page.tsx. This catch-all route:
- Receives the URL slug as an array (e.g.
['guides', 'deployment']) - Calls
getDocBySlug()to find and load the matching MDX file - Compiles the MDX content with
next-mdx-remote - Renders the page with the docs layout (sidebar, navbar, TOC)
Static export
Trellis Docs uses output: 'export' in next.config.mjs, which generates static HTML at build time. The generateStaticParams() function in the catch-all route returns all valid slugs so Next.js knows which pages to pre-render.
See Static Site Generation for details on the build output.
Trailing slashes
Trellis Docs uses trailing slashes by default (trailingSlash: true in next.config.mjs). This means:
/getting-started/works (canonical)/getting-startedredirects to/getting-started/
The static export generates out/getting-started/index.html for each page, which web servers serve at the trailing-slash URL.
Blog and release notes routes
Blog posts and release notes use separate route handlers:
| Content type | File location | URL pattern |
|---|---|---|
| Docs | content/docs/ | /{slug}/ |
| Blog | content/blog/ | /blog/{slug}/ |
| Release notes | content/release-notes/ | /release-notes/{slug}/ |
| API docs | content/api/ | /api/{slug}/ |
Hidden files
Files and folders starting with _ are excluded from routing. See Docs for details on the partial file convention.