The documentation site features readers depend on most are fast full-text search, a sidebar that shows where they are, a page table of contents, code blocks they can copy, stable links to headings, a visible “last updated” date, an edit link, and a clear path from getting started to reference. Everything else (versioning, translations, feedback widgets, API reference generation) depends on the product and the audience.
This list is organized by what a docs reader is trying to do: find something, understand it, act on it, and trust it. For each feature it notes whether Starlight, Astro’s docs framework, includes it and how to add it to a custom Astro site if it doesn’t.
Key Takeaways
- Search and navigation come first. Most docs visits start with a search box or a sidebar, not the home page.
- Code examples must be copyable, complete and correct for the current version, ideally tested in CI.
- Show trust signals on every page: last updated date, version, and an edit or feedback link.
- Structure content by type (tutorials, how-to guides, reference, explanation) so readers know what each page is for.
- Starlight includes most of the core list out of the box; a custom Astro build needs each one wired up.
Find: search and navigation
Full-text search
Readers search first. A docs site without good search pushes them back to a general search engine, where an outdated forum post may outrank you.
Requirements: results as you type, matches in headings ranked above body text, keyboard access (a / or Ctrl+K shortcut), and results that link straight to the heading that matched.
- Starlight: built in, using Pagefind. The index is built during
astro buildand loaded only when someone searches. - Custom Astro: add Pagefind as a post-build step and a search component. The Pagefind search guide shows the setup. For very large sites, hosted search (Algolia DocSearch) adds typo tolerance and analytics.
A sidebar that shows position
The sidebar is the map. It should show the current page highlighted, its section expanded, and other sections collapsed. Group by task or topic, not by internal team structure.
- Starlight:
sidebarconfig with manual groups orautogenerate: { directory }from your folder structure. - Custom Astro: generate the tree from your content collection and mark the active item by comparing
Astro.url.pathname. The active nav link tip shows the comparison.
Page table of contents
Long reference pages need an “On this page” list of headings, ideally highlighting the section currently in view.
- Starlight: built in, with configurable heading depth.
- Custom Astro:
render(entry)returns aheadingsarray; map it to links. The table of contents tip adds scroll highlighting.
Breadcrumbs and previous/next links
Breadcrumbs answer “where am I” when a reader lands from search. Previous and next links at the bottom turn a guide into a sequence.
- Starlight: previous and next links built in; breadcrumbs via a component override.
- Custom Astro: build both from the sidebar data. The breadcrumbs component includes the matching structured data.
Stable, linkable headings
Every heading needs an id and a visible anchor link, so support teams and readers can link to the exact paragraph. Once published, don’t change heading text casually; it changes the anchor and breaks inbound links.
Understand: content structure
Clear page types
A widely used model (Diátaxis) splits docs into four kinds of page:
| Type | Reader’s goal | Example |
|---|---|---|
| Tutorial | Learn by doing, start to finish | “Build your first project” |
| How-to guide | Solve a specific problem | “Deploy to Cloudflare Pages” |
| Reference | Look up a fact | “Configuration options” |
| Explanation | Understand why | “How caching works” |
Mixing them on one page is the most common reason docs feel hard to use. A reference page that stops to teach concepts is slow to scan; a tutorial that lists every option loses beginners.
A real getting-started path
The first page after the home page should take a new user from nothing to a working result in a few minutes, with every command shown. Test it on a clean machine before each release. As an example, the Komal getting started docs take a theme from clone to running dev server in a handful of commands.
Callouts for warnings and notes
Notes, tips, warnings and danger callouts help readers spot what matters. Use them sparingly; a page where every paragraph is a callout has none.
- Starlight: asides with
:::note,:::tip,:::cautionand:::dangersyntax in Markdown, plus the<Aside>component. - Custom Astro: an MDX callout component, or a Markdown directive plugin.
Diagrams
Architecture and flow diagrams explain in seconds what takes paragraphs. Mermaid diagrams written in Markdown keep them versioned with the text. The Mermaid diagrams tip renders them at build time.
Act: code and commands
Copyable code blocks
Every code block needs a copy button, a language label, and syntax highlighting that works in light and dark mode. Commands should be copyable without the prompt character ($).
- Starlight: Expressive Code is built in: copy buttons, file name titles, line highlighting, diff markers and terminal frames.
- Custom Astro: Shiki highlighting is built into Astro; add a copy button with a small script, or install Expressive Code as an Astro integration. The copy code button component is a lightweight option.
Package manager tabs
Readers use npm, pnpm, Yarn or Bun. Tabs that show the same install command for each, and remember the reader’s choice across pages, remove a small but constant friction.
- Starlight: the
<Tabs>component withsyncKeykeeps the selection consistent across the site. - Custom Astro: a tabs component with a small script and
localStorage. The tabs component guide covers accessible markup.
Steps and file trees
Numbered procedures with code inside each step, and a visual file tree for project structure, are two of the most reused patterns in technical docs.
- Starlight:
<Steps>and<FileTree>components. - Custom Astro: an ordered list with styled counters; a nested list for the file tree.
Code that is tested
Wrong examples are worse than none. Keep larger examples in real files that CI builds or tests, and import them into pages, so a breaking change fails the build instead of reaching readers.
Trust: freshness and feedback
Last updated date
A visible date tells readers whether the page reflects the current release.
- Starlight:
lastUpdated: truereads the date from Git history. - Custom Astro: an
updatedDatefield in frontmatter, or the Git commit date at build time.
Edit this page link
A link to the source file on GitHub turns readers into contributors and makes small fixes cheap.
- Starlight:
editLink.baseUrlin config. - Custom Astro: build the URL from the entry’s file path.
Version information
If users run different versions, the docs must say which version they describe, and older versions should stay available. Options range from a version badge plus migration guides (simplest) to full versioned copies with a version switcher (most work). In Starlight, the community starlight-versions plugin handles the second.
A feedback path
“Was this page helpful?” buttons, a link to open an issue with the page URL prefilled, or a community forum link. Whatever you choose, someone has to read the results.
Reach: SEO, AI and access
Unique titles and descriptions
Docs pages compete in search with blog posts and forum answers. A descriptive title (“Configure environment variables”) beats a terse one (“Env”).
Sitemap, canonical URLs and redirects
Docs get reorganized often. Every moved page needs a redirect from its old URL, and the sitemap must reflect the new structure. Both Starlight and plain Astro use @astrojs/sitemap and the redirects config.
Broken link checks
Internal links break with every restructure. In Starlight, starlight-links-validator fails the build on broken links and anchors. In a custom build, run a link checker against dist/ in CI.
AI-friendly output
Developers increasingly ask AI assistants instead of searching. Clean server-rendered HTML, clear headings and an llms.txt file make your docs easier for those tools to use accurately. The llms.txt and AI citations guide covers the setup.
Translations
Only translate when you can keep translations current. A stale translation is worse than a good English page. Starlight’s locales option handles routing, language switching and fallback to the default language for untranslated pages.
Accessibility
Keyboard navigation for the sidebar, search and tabs; visible focus states; sufficient contrast in both color schemes; and a skip link to the main content. Starlight is built with these in mind; a custom build needs them checked explicitly.
Starlight or a custom Astro docs site?
| Feature | Starlight | Custom Astro |
|---|---|---|
| Search | Built in (Pagefind) | Add Pagefind |
| Sidebar, TOC, prev/next | Built in | Build from collection |
| Code blocks with copy, titles | Built in (Expressive Code) | Shiki plus script, or Expressive Code |
| Tabs, steps, file tree, asides | Built in components | Build or install |
| Last updated, edit link | Config options | Build from Git or frontmatter |
| i18n | Built in | Astro i18n routing plus your UI |
| Full design control | Overrides and CSS | Complete |
Choose Starlight if you want the core feature set working today and are happy with its layout as a starting point. Choose a custom Astro build if the docs are part of a marketing site with its own design, or if you need a layout Starlight’s overrides can’t reach. The Astro or Starlight decision guide goes deeper, and the Starlight plugins list covers what to add once you’ve chosen Starlight.
For a designed starting point that isn’t Starlight, Komal Nakrani’s Astro documentation themes are plain Astro projects with docs layouts you can extend. The official Starlight documentation lists every built-in feature in detail.
FAQ
What makes a good documentation website?
Fast search, clear navigation that shows where you are, content split by purpose (tutorials, how-to guides, reference, explanation), copyable and correct code examples, and visible signals of freshness such as a last updated date and version.
What is the best framework for a documentation site in Astro?
Starlight, Astro’s official docs framework, covers search, navigation, code blocks, i18n and accessibility out of the box. A custom Astro site makes sense when the docs need to match a bespoke design or live inside a larger marketing site.
Do documentation sites need versioning?
Only if users run older versions that behave differently. Many projects do well with one current version plus a migration guide per major release, which is far easier to keep accurate than multiple full copies.
How do I add search to a static docs site?
Use Pagefind, which indexes the built HTML after the build and serves a static index, so it works on any static host. Starlight includes it by default.
Should documentation have a feedback form?
A simple feedback path helps, such as a “Was this helpful?” control or a link to open an issue with the page URL. It’s only useful if someone reviews the feedback and updates the pages.