Quick start
Start from an empty directory with tola init, verify live preview, then add metadata, a shared HTML shell, and CSS before running tola check and tola build.
Initialize
Create a new site with tola init (pass --dry-run first to preview generated files):
tola init my-site --dry-run
tola init my-site
cd my-siteBy default, init expects a missing or empty directory (pass --force when adding to an existing directory; existing files with the same name are not overwritten). Default layout:
my-site/
├── tola.toml # Site configuration
├── site.typ # Default entry program
├── content/ # Content sources
├── .gitignore
└── .ignoreThe generated site.typ already includes a basic loop that compiles .typ files in content/ to HTML alongside a default 404.html. To initialize from a theme or starter module, run tola init my-site --from <path-or-url> --alias <alias> (see Modules).
First pages
Create a home page and a subpage under content/:
= My Site
Welcome to my first Tola site. See #link("/guide/install/")[Install guide].= Install guide
Run `tola --version` to verify your local build.
$ a^2 + b^2 = c^2 $Start the development server:
tola devOpen the printed address (default http://127.0.0.1:5277/) and follow “Install guide” to /guide/install/. Editing and saving content/guide/install.typ updates the browser automatically without restarting the server.
Layout and styles
Add tola-meta at the top of both content files and switch the main heading to #title(), which outputs <h1>:
#import "@tola/source:0.0.0": tola-meta
#tola-meta((title: "My Site"))
#title()
Welcome to my first Tola site. See #link("/guide/install/")[Install guide].#import "@tola/source:0.0.0": tola-meta
#tola-meta((title: "Install guide"))
#title()
Run `tola --version` to verify your local build.
$ a^2 + b^2 = c^2 $Add a stylesheet, declare it under [assets] in tola.toml, and update site.typ to validate metadata and render a shared HTML shell:
body {
margin: 0;
font-family: system-ui, -apple-system, sans-serif;
line-height: 1.7;
color: #1f2937;
}
main {
max-width: 44rem;
margin: 3rem auto;
padding: 0 1.25rem;
}[site]
title = "My Site"
language = "en"
[assets]
files = [{ source = "static/site.css", url = "/site.css" }]#import "@tola/address:0.0.0": asset-url, join-route, output-of
#import "@tola/schema:0.0.0" as s
#import "@tola/site:0.0.0": site
#import "@tola/source:0.0.0": all-sources, parse-sources
#let page-schema = s.schema((title: s.non-empty(s.trim(str))))
#let sources = parse-sources(all-sources(), page-schema)
#set text(
lang: site.language.lang,
script: site.language.script,
region: site.language.region,
)
#for source in sources {
let output = output-of(join-route(source.route-segments))
document(output, format: "html", title: source.meta.title)[
#html.html(lang: site.language.tag)[
#html.head[
#html.meta(charset: "utf-8")
#html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
#html.title[#source.meta.title | #site.title]
#html.link(rel: "stylesheet", href: asset-url("/site.css"))
]
#html.body[
#html.main[#include source.file]
]
]
]
}
#document("404.html", format: "html", title: "Not found")[
#html.main[= Not found]
]Save and check the browser—both pages immediately reflect the new layout and stylesheet.
Check and build
Try temporarily changing #link("/guide/install/") on the home page to #link("/guide/missing/") and saving: tola dev reports the broken link immediately, and clears it once restored.
Stop the dev server with Ctrl+C, then run a full check and production build:
tola check
tola buildtola check compiles the site and validates output paths, static assets, and internal links without modifying public/. tola build atomically writes the verified output to public/:
public/
├── index.html
├── 404.html
├── site.css
└── guide/
└── install/
└── index.html