Project structure
Example structure
my-stati-site/
├── package.json
├── stati.config.js
├── public/
│ ├── favicon.svg
│ └── styles.css
└── site/
├── index.md
├── layout.eta
└── partials/
├── header.eta
└── footer.eta
With TypeScript enabled
TypeScript is the scaffolder’s default, and a TypeScript project gets these additional files (pass --no-typescript for a JavaScript project):
my-stati-site/
├── package.json
├── stati.config.ts # TypeScript configuration
├── tsconfig.json # TypeScript compiler config
├── src/
│ └── main.ts # TypeScript entry point
├── public/
│ └── ...
└── site/
└── ...
Key directories
site/
This is where all your content lives. Stati uses filesystem-based routing, so the structure of your site/ directory directly maps to the URLs of your website.
site/index.md→/site/about.md→/aboutsite/blog/index.md→/blogsite/blog/first-post.md→/blog/first-postsite/blog/tags/[tag].mdwithgenerate: { from: tags }→/blog/tags/css,/blog/tags/javascript… one page per tag, and none at its own URL. See Generated pages.
Images can sit next to the pages that use them. In site/blog/first-post.md,  refers to site/blog/map.png, which Stati copies to /_img/ with its size added to the page. See Images.
public/
Static assets that should be copied directly to the output directory. Everything in public/ is served from the root of your site.
public/favicon.svg→/favicon.svgpublic/images/logo.png→/images/logo.pngpublic/styles.css→/styles.css
site/partials/
Templates that layouts and other templates include with stati.include(), such as the header and footer. Only Markdown files become pages, so a folder of templates adds no URLs.
The folder name is a convention: any .eta file under site/ can be included by its path, without the extension.
Example organization:
site/partials/header.eta- Site header, included withstati.include('partials/header')site/partials/footer.eta- Site footersite/partials/nav/sidebar.eta- Navigation sidebar, included withstati.include('partials/nav/sidebar')
Configuration files
stati.config.js (or stati.config.ts)
The main configuration file where you define site metadata, template helpers, Markdown plugins, and more. Use .ts for TypeScript projects with full type safety.
import { defineConfig } from '@stati/core';
export default defineConfig({
site: {
title: 'My Stati Site',
baseUrl: 'https://example.com',
},
// Additional configuration...
});
For TypeScript projects, you can also configure the built-in TypeScript compilation:
export default defineConfig({
site: { title: 'My Stati Site', baseUrl: 'https://example.com' },
typescript: {
enabled: true,
// bundles defaults to [{ entryPoint: 'main.ts', bundleName: 'main' }]
},
});
See the TypeScript Configuration guide for more details on multiple bundles and per-page targeting.
Template files
Layouts
layout.eta- Default layout templateblog/layout.eta- Section-specific layoutblog/index.eta- Optional layout of the index pageblog/index.md, used ahead oflayout.etaonce the folder holds other pagesbase.eta- Optional page shell that layouts share, named withstati.layout('base')
A page uses the nearest layout.eta from its folder up, so site/blog/layout.eta replaces site/layout.eta for the pages in site/blog/. Included templates are looked up the same way, from the page’s folder up: site/blog/partials/header.eta replaces site/partials/header.eta on the pages in site/blog/.
You can also give a page its own layout by naming it in the page’s front matter, without the .eta extension. Stati looks for the name from the page’s folder up to site/, so layout: home on a page in site/ uses site/home.eta; a name starting with /, such as layout: /home, is read from site/ only. If no file matches, the build warns and falls back to the usual layout.eta lookup.
Content files
.mdfiles - Markdown content with front matter; every.mdfile outside an underscore folder becomes a page, apart from drafts and[param].mdtemplates.etafiles - Layouts, shells and included templates; an.etafile never becomes a page on its ownog.eta- Withimages.og, the template for the link preview image of the pages in its folder and below
Advanced structure
For larger sites, you might organize content like this:
site/
├── index.md
├── layout.eta
├── about.md
├── blog/
│ ├── index.md
│ ├── layout.eta
│ ├── 2024/
│ │ ├── first-post.md
│ │ └── second-post.md
│ └── partials/
│ └── post-meta.eta
├── docs/
│ ├── index.md
│ ├── layout.eta
│ └── api/
│ ├── index.md
│ └── reference.md
├── base.eta
└── partials/
├── header.eta
├── footer.eta
└── nav.eta
Special files and directories
Directories starting with _
- Excluded from routing - Markdown inside them won’t generate pages
- Templates still work - Like any
.etafile undersite/, a template in one can be included withstati.include() - Examples:
_drafts/,_data/
Note: Individual files starting with
_(like_draft.md) are NOT automatically excluded. Usedraft: truein front matter to exclude drafts.
Index files
index.md- Becomes the directory’s homepagesite/blog/index.md→/blog(written todist/blog.html)- No index file → 404 (add an
index.mdto make the directory accessible)
Build output
When you run stati build, the output structure mirrors your site structure:
dist/
├── index.html
├── about.html
├── blog.html
├── blog/
│ └── first-post.html
├── _assets/ # hashed stylesheets and script bundles
├── _img/ # images copied from site/, and generated ones
├── favicon.svg
└── styles.css
Next steps
- Learn about Templates and layouts
- Understand Filesystem-based Routing
- Explore Static Assets
- Configure your Site Metadata
- Enable TypeScript Compilation