Metadata

Tola has no hardcoded frontmatter fields. Sources declare metadata at the top with tola-meta, and the site entry or theme enforces structure and defaults with @tola/schema.

Declaring metadata

Call tola-meta once at the top of each content file (or wrap it in a theme helper such as #post(title: ...)):

typst
#import "@tola/source:0.0.0": tola-meta

#tola-meta((
  title: "Build model",
  order: 10,
  draft: false,
  published: "2026-09-01",
))

#title()

Validation

Prefer parse-sources(all-sources(), schema) over manual checks so missing fields and type mismatches report directly on the offending source file and field path:

typst
#import "@tola/schema:0.0.0" as s
#import "@tola/source:0.0.0": all-sources, parse-sources

#let page-schema = s.schema((
  title: s.non-empty(s.trim(str)),
  order: s.optional(int, default: 0),
  draft: s.optional(bool, default: false),
  published: s.optional(s.date),
))

#let pages = {
  parse-sources(all-sources(), page-schema)
    .filter(source => not source.meta.draft)
}
  • schema((...)) rejects unknown keys by default so typos fail fast; pass unknown: "keep" to retain undeclared fields.
  • optional(T, default: ...) allows missing keys with a default value; nullable(T) allows explicit none. Present values with the wrong type still fail instead of falling back silently.
  • Drafts go through discovery and parse-sources too, so syntax or type errors in drafts (such as draft: "true") fail tola check.

Common types

CombinatorPurpose
non-empty(trim(str))Applies inside-out: trim whitespace, then require non-empty.
one-or-many(str)Accepts either a single value or array and normalizes to an array (tags, authors).
enum-of(("a", "b"))Restricts to a fixed set of string literals.
url-path / https-urlValidates site paths or well-formed HTTPS URLs.
dateParses calendar dates ("2026-09-01").
timestampParses timestamps with timezone; .rfc3339 feeds straight into @tola/feed and @tola/sitemap.
partial-dateAccepts year or year-month ("2026", "2026-09").
union(date, timestamp)Accepts either calendar dates or timestamps.

Use check(...) for cross-field rules and pass a function as the second argument to parse-sources to pick different schemas per directory:

typst
#import "@tola/schema:0.0.0" as s
#import "@tola/source:0.0.0": all-sources, parse-sources

#let base-schema = s.schema((
  title: str,
  draft: s.optional(bool, default: false),
  published: s.optional(s.timestamp),
))

#let post-schema = s.check(
  base-schema,
  meta => if not meta.draft and meta.published == none {
    (s.issue("Published posts must specify `published`", path: ("published",)),)
  } else { () },
  on: ("draft", "published"),
)

#let sources = parse-sources(
  all-sources(),
  source => if source.path.starts-with("blog/") { post-schema } else { base-schema },
)

Theme conventions

Fields like draft, order, permalink, and layout are conventions of your site entry or theme rather than built-in keywords. Check tola <alias> guide or your theme’s docs before switching themes.

Search this site

Use the arrow keys to move through results.

Type to search.