@tola/feed
Generate RSS, Atom, or JSON Feed outputs from site documents.
Import
#import "@tola/feed:0.0.0": *Exports
feed
let feed(
authors: auto | array = auto,
description: auto | content | string = auto,
entries: array = (),
format: string = "rss",
id: auto | string = auto,
language: auto | string = auto,
output: auto | string = auto,
title: auto | content | string = auto,
) = content;Emit an RSS, Atom, or JSON Feed file into the site bundle.
Requires site.origin in [site] so entry links resolve to absolute URLs.
Entry fields
Each entry requires target (an output path, (output:, fragment:), label, or location) and published (a Typst datetime interpreted in UTC, or an RFC 3339 timestamp string—pass .rfc3339 from @tola/schema#timestamp). Optional fields: id (keep stable across URL moves; must be an absolute URI in Atom), title (defaults to the target document title), updated, summary, content, and authors.
| Format | summary | content |
|---|---|---|
| RSS | <description> | <content:encoded> |
| Atom | <summary> | <content> (text or HTML) |
| JSON Feed | summary (plain text) | content_text or content_html |
Entry content forms
- Plain string: written as plain text.
- Simple Typst content (text, line breaks, emphasis, strong, strike, URL links): converted directly to HTML without layout or show rules.
- Rendered HTML extraction: pass
(document: output, id: "post-body")to extract that element (and its descendants, plus<head>styles) from the exported HTML, or omitidto take the entire<body>. Relative URL attributes are rewritten to absolute URLs.
Named parameters
outputauto | stringdefault:auto: Publish-relative output path.autoselectsfeed.xml(RSS),atom.xml(Atom), orfeed.json(JSON Feed).formatstringdefault:"rss": Feed format:"rss"(default),"atom", or"json".idauto | stringdefault:auto: Feed identifier. Required to be an absolute URI for Atom;autoderives it fromsite.url.titleauto | content | stringdefault:auto: Feed title (must be non-blank).autousessite.title.descriptionauto | content | stringdefault:auto: Feed description.autousessite.description.languageauto | stringdefault:auto: BCP 47 language tag.autousessite.language.tag.authorsauto | arraydefault:auto: Array of(name:, email:, url:)author dictionaries.autousessite.authors. Atom requires an author on the feed or on every entry.entriesarraydefault:(): Array of entry dictionaries in publication order. Defaults to().
Publish an RSS feed with extracted HTML content
#import "@tola/feed:0.0.0": feed
#let output = "notes/index.html"
#document(output, title: [First Note])[
#html.html[
#html.head(html.title("First Note"))
#html.body[
#html.article(id: "post-body")[
= First Note
Full article body included in the feed.
]
]
]
]
#feed(
title: "Field Notes",
entries: ((
id: "urn:notes:first",
target: output,
published: datetime(year: 2026, month: 9, day: 1),
summary: "Short summary for feed previews.",
content: (document: output, id: "post-body"),
),),
)