Writing content
Keep documentation close to the subject it explains, use clear page titles, and prefer small focused pages over very long catch-all documents.
Frontmatter
Section titled “Frontmatter”Every page must include a title. A description is strongly recommended:
---title: API authenticationdescription: Configure and use API authentication.---Useful optional fields include draft, sidebar, tableOfContents, and template.
Organize by intent
Section titled “Organize by intent”A practical structure is:
src/content/docs/├── getting-started.md├── tutorials/├── guides/├── reference/└── concepts/Use directories only when they make navigation easier. Starlight can generate sidebar navigation directly from this filesystem structure.
Prefer relative links between documentation pages:
See [Deployment](./deployment/).Relative links continue to work when the site is deployed under a GitHub Pages repository subpath.
Code examples
Section titled “Code examples”Use fenced code blocks with a language identifier:
```tsexport function greet(name: string) { return `Hello ${name}`;}```Draft pages
Section titled “Draft pages”Keep unfinished pages in the repository without publishing them:
---title: Upcoming featuredraft: true---Draft pages are excluded from production builds.
When to use MDX
Section titled “When to use MDX”Use plain Markdown by default. Introduce MDX only when a page genuinely needs imported components or richer interactive content. Reusable content components live in src/components/content/; see Custom components for the recommended pattern.