Build model

Tola splits the build between the host binary and your Typst entry program: the host merges configuration, discovers sources, schedules hooks, collects static assets, checks the output graph, and publishes atomically; the entry program filters content, computes routes, renders pages, and declares Bundle assets.

Pipeline

Tola build pipeline:Preparation loads config, runs before-build, and scans sources; compilation evaluates the Typst Bundle alongside static assets and generate-outputs; verification checks the output graph before preview or atomic publish. Tola build pipeline:Preparation loads config, runs before-build, and scans sources; compilation evaluates the Typst Bundle alongside static assets and generate-outputs; verification checks the output graph before preview or atomic publish.
  1. Prepare & discover: Merge tola.toml, include files, and module manifests, run before-build hooks, then scan content-dir and read top-level tola-meta. Because before-build runs first, generated .typ files are discovered in the same build.
  2. Compile & assemble: Compile [build].entry as one Typst Bundle to emit every document(...), asset(...), and derived image/icon, gather [assets], and pass the snapshot to generate-outputs hooks.
  3. Verify & publish: Combine all outputs into one graph and check output path uniqueness, internal links, asset references, and fragments. check and preview stop here; build swaps publish-dir atomically (removing deleted pages) and runs after-publish.

Source discovery

[build].entry defaults to "site.typ" at the project root, or { module = "docs" } to delegate to a theme module’s build entry.

The entry calls all-sources() from @tola/source:0.0.0 to list sources under [build].content-dir (default content/):

  • Only lowercase .typ files are collected, sorted deterministically by full source path.
  • Hidden files, hidden directories, symlinks, and the entry file itself are skipped automatically.
  • Keep shared templates, styles, and helper modules outside content/ so they are not treated as pages.
typst
#import "@tola/address:0.0.0": join-route, output-of
#import "@tola/source:0.0.0": all-sources

#for source in all-sources() {
  let output = output-of(join-route(source.route-segments))
  document(output, format: "html")[
    #include source.file
  ]
}

Because discovery runs before rendering and the entire site evaluates in one Bundle, the entry can filter drafts, sort pages, emit both HTML and format: "pdf" from one source, or generate extra archive, tag, and JSON index outputs outside the loop.

Build mode

site.build-mode in @tola/site:0.0.0 identifies the current command environment:

site.build-modeContext
"dev"tola dev live development server.
"prod"tola build, tola check, tola preview.
noneNon-build commands: tola lsp, tola query, tola inspect.
typst
#import "@tola/site:0.0.0": site

#let is-prod = site.build-mode == "prod"

Split config

Large configs can pull in local TOML files via include at the top of tola.toml before the first [table] header:

toml
include = [
  "config/docs.toml",
  "config/reference.toml",
  { path = "config/local.toml", optional = true },
]

[site]
title = "Tola"

Paths inside include resolve relative to the declaring config file, while config values (such as static/... or tools/...) always resolve relative to the site root containing tola.toml. Files merge in order with the root tola.toml applied last: tables merge by key, scalars and plain arrays overwrite earlier values, and [assets] and [[hooks.*]] append in order. Run tola inspect config to verify the merged result.

Languages

Set language and languages = ["en", "zh-Hans"] under [site] to expose parsed locale records (tag, lang, script, region) through site.language and site.languages.

Search this site

Use the arrow keys to move through results.

Type to search.