@tola/sitemap

Generate an XML sitemap listing published site documents for search engines.

Import

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

Exports

sitemap

typc
let sitemap(
  output: string = "sitemap.xml",
  targets: array = (),
) = content;

Emit a sitemap.xml file listing absolute URLs and optional lastmod timestamps.

Requires site.origin in [site]. lastmod accepts a Typst datetime (UTC), a "YYYY-MM-DD" date string, or an RFC 3339 timestamp string (pass .rfc3339 from @tola/schema#timestamp).

Named parameters

  • output string default: "sitemap.xml": Publish-relative output path, defaulting to "sitemap.xml".
  • targets array default: (): Array of unique complete documents: each entry is an output path, document label, location, or (target:, lastmod:) dictionary. Element targets or fragments are rejected.

Generate `sitemap.xml` with last-modified dates

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

#document("index.html")[Home]
#document("guide/index.html")[Guide]

#sitemap(targets: (
  "index.html",
  (target: "guide/index.html", lastmod: datetime(year: 2026, month: 9, day: 1)),
))

Search this site

Use the arrow keys to move through results.

Type to search.