Project Structure
Where everything lives in an Astro theme, and which directories are special.
Updated: September 2026ยทLicense: Commercial & Personal
Directory layout
text
your-theme/
โโโ public/ # Copied to the build as-is (favicon, fonts, images)
โโโ src/
โ โโโ pages/ # File-based routes โ every file here becomes a URL
โ โโโ layouts/ # Page shells wrapped around route content
โ โโโ components/ # Reusable .astro components
โ โโโ content/ # Markdown and MDX collections
โ โโโ styles/ # Global stylesheets and design tokens
โ โโโ content.config.ts # Collection schemas
โโโ astro.config.mjs # Astro config and integrations
โโโ package.json
The two directories that are special
src/pages/ drives routing. There is no route config โ the file path is the URL:
| File | URL |
|---|---|
src/pages/index.astro |
/ |
src/pages/about.astro |
/about/ |
src/pages/work/[slug].astro |
/work/anything/ |
public/ is copied to the output untouched. A file at public/logo.svg is served at /logo.svg. Put things here only when they must keep their exact filename โ everything imported through src/ gets hashed and optimised instead.
Unlock every theme
Get lifetime access to 2,836 themes for $199 USD (Regular $499 USD).