Add a project
Every project lives in its own folder under src/content/docs/projects/. Adding
one is three steps and takes about two minutes.
1. Copy the template
Section titled “1. Copy the template”cp -r templates/project-docs src/content/docs/projects/my-projectUse the project’s real name, lowercased and hyphenated — it becomes the URL:
src/content/docs/projects/my-project/ is served at /projects/my-project/.
2. Register it in the sidebar
Section titled “2. Register it in the sidebar”Open astro.config.mjs and add a block to the sidebar array, below the
Projects comment:
sidebar: [ { label: 'Start here', items: [/* … */], }, { label: 'my-project', collapsed: true, items: [{ autogenerate: { directory: 'projects/my-project' } }], },],autogenerate builds the project’s nav from the files on disk, so you never
have to touch the config again as you add pages. Ordering inside the group comes
from each page’s sidebar.order frontmatter, falling back to alphabetical.
3. Link it from the home page
Section titled “3. Link it from the home page”In src/content/docs/index.mdx, replace the placeholder card with a real one:
<CardGrid> <LinkCard title="my-project" href="/projects/my-project/" description="One line on what it does and who it's for." /></CardGrid>4. Check your work
Section titled “4. Check your work”npm run devThen visit http://localhost:4321. Before pushing, run the real build — it
fails on broken internal links, which catches most mistakes:
npm run buildWhere to put images
Section titled “Where to put images”Put them next to the page that uses them, or in src/assets/ for anything
shared. Reference them with a relative path and Astro will optimise and hash
them:
Files in public/ are copied verbatim without optimisation — use that only for
things that need a stable URL, like a PDF you link to from elsewhere.
Pulling docs from another repository
Section titled “Pulling docs from another repository”If you’d rather keep a project’s docs next to its code, add that repo as a submodule and symlink it in:
git submodule add https://github.com/you/my-project vendor/my-projectln -s ../../../../vendor/my-project/docs src/content/docs/projects/my-projectKeep the frontmatter conventions the same in the upstream repo, and remember to
run git submodule update --remote before building. This is more machinery than
it sounds — only reach for it once editing docs in this repo starts to feel like
the wrong place.