@tola/site

Read resolved [site] settings, [options], build-mode, and site-rooted paths inside Typst.

Import

typst
#import "@tola/site:0.0.0": *

Exports

site

typc
site: dictionary (site values)

Dictionary of resolved [site] configuration, [options], and the current build mode.

FieldValue
originConfigured origin string, or none.
base-pathDeployment prefix starting and ending with / (default "/").
urlorigin + base-path, or none when origin is unset.
title, descriptionConfigured strings (empty string when unset).
authorsArray of (name:, email:, url:) dictionaries.
languageDefault language record (tag:, lang:, script:, region:) (defaults to "en"; missing script is auto, missing region is none).
languagesConfigured language list in order (defaults to ()).
optionsDictionary from [options] in tola.toml (defaults to (:)).
build-mode"dev" under tola dev, "prod" under tola build/check/preview, or none outside a build (editor, tola query, tola inspect).

Skip heavy work during `tola dev`

typst
#import "@tola/site:0.0.0": site

#let is-dev = site.build-mode == "dev"
#document("index.html")[#site.title]

project-path

typc
let project-path(
  path: str,
) = path;

Resolve a site-root-relative path as a native Typst path, even when called from a module or package.

Pass the returned path directly to read(...), json(...), or csv(...) so themes and helper modules can load files from the consuming site.

Positional parameters

  • path str required: Path relative to the site root directory (for example "data/catalog.json").

Search this site

Use the arrow keys to move through results.

Type to search.