@tola/sitemap
Generate an XML sitemap listing published site documents for search engines.
Import
#import "@tola/sitemap:0.0.0": *Exports
sitemap
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
outputstringdefault:"sitemap.xml": Publish-relative output path, defaulting to"sitemap.xml".targetsarraydefault:(): 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
#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)),
))