Start
Starting from scratch
The starter is one way to begin, not the only one. To design a site yourself, make it without the starter and write its templates: Statac needs none of the starter’s files.
Make the site
statac new --no-starter my-site
Made a new site in `my-site`: 2 files.
Times are in Europe/London, as this machine is set.
statac.yaml:
title: My Site
language: en-GB
timezone: Europe/London
date_format: 31 December 2025
date_short: 31 Dec 2025
date_day: 31 Dec
date_stamp: 31 Dec 2025, 15:04
feed_key: 27e0ced8-2ca3-8e78-aaea-507b11e02966
Next: `cd my-site`, then add your own templates to `templates/`: see https://statac.dev/templates/.
--no-starter asks the first four of
the questions and skips the last. Answering 2 to
the last question, “What should the site start with?”, does the same.
The site holds two files:
| File | What’s in it |
|---|---|
statac.yaml | The site’s settings, made from your answers as they are for a site with the starter. |
.gitignore | Keeps .statac/ and _site/ out of the site’s history. |
Only the starter’s templates use date_short, date_day and
date_stamp. Keep them if you might take
files from the starter later. Otherwise, remove them.
The first page
In content/index.md:
---
title: Home
---
Hello.
With the page and no template, the build stops and names the template the page needs:
error Missing template: there is no `templates/home.html`
content/index.md, line 1
1 │ ---
│ ^^^
Add the template, or choose another with `layout:`.
More: https://statac.dev/e/missing-template/
Wrote nothing: 1 error stopped the build.
In templates/home.html:
<!doctype html>
<html lang="{{ page.language }}">
<title>{{ site.title }}</title>
<h1>{{ page.title }}</h1>
{{ page.content }}
</html>
Wrote 1 page and 1 other file to `_site` in 0.00 seconds.
The other file is code.css. Run
statac serve to watch the site in a browser as you write: see
serving a site.
A template for each kind of page
As the site grows, each kind of page needs its template. Statac names each one that is missing, so build as you go and add them as you’re asked.
| When the site has | It needs |
|---|---|
| A home page | templates/home.html |
| Any page that isn’t the home page or a list’s page | templates/page.html |
A folder’s own page, its index.md, or a tag’s or a series’ page | templates/folder.html |
A page with redirect_to or redirect_from | templates/ |
An address in its url, and dated posts | templates/feed.xml, for the feeds. Without it, the feeds are left out and statac check warns of it. |
A page’s layout: chooses another template, and a folder’s
pages.layout: chooses one for every page in it: see
which template builds a page. Put what every page
shares in one template and extend it in the
others.
The starter also makes these pages. Add whichever you want:
| Page | How to make it |
|---|---|
| A page for addresses where nothing is published | content/404.md with permalink: /404.html, built with page.html unless it sets a layout:. statac serve, and many web hosts, show /404.html at an address with nothing published at it. |
| A sitemap | content/sitemap.md and templates/sitemap.xml: see a sitemap. |
robots.txt | content/robots.md and templates/robots.txt: see robots.txt. |
What Statac writes for you
Some of what’s on a page comes from Statac, not from the starter, so a site without the starter has it too:
- The writing. Headings, links, pictures, code, footnotes and
callouts are built as plain HTML, which your stylesheet styles. A file
in
snippets/markdown/replaces any of them: see without a file of your own. - Pictures in several sizes. A picture written in Markdown is published in several sizes, as AVIF with a JPEG fallback.
- The colours for code. Each build publishes
code.css. Link it in your template’s<head>to colour code blocks.
Taking from the starter
The starter lists every file the starter has. To take one, make a site with the starter in another folder and copy the file across. The starter’s files are ordinary templates, snippets and stylesheets, and most start with a line saying what they build.
To take them all, run this in the site’s folder:
statac new --update --missing
It writes every starter file the site doesn’t have, and
data/words.yaml, which holds the words they show readers. It doesn’t
write the sample posts, notes and photographs.
Without --missing, statac new --update on a site that has none of
the starter’s files says so once, and changes nothing:
This site has none of the starter's files. To add them, run `statac new --update --missing`.
Once a site has a starter file, --update keeps it up to date as
described in bring the starter up to date, and lists
the starter files the site doesn’t have.
Where next?
- Templates: which template builds a page, and everything a template can show
- Snippets: pieces of HTML you call by name, and how the pieces of the writing are built
- Assets and static files: stylesheets, scripts and files published as they are
- Feeds, sitemaps and other files: a feed’s template, a
sitemap and
robots.txt
Something unclear or wrong? Open an issue on GitHub.