Documentation
¶
Overview ¶
Package build turns a site's inputs into an immutable Site snapshot. Writing it to disk (build) or serving it from memory (dev) happens afterwards, so both share this code path.
Index ¶
Constants ¶
const NotFoundPath = "404.html"
NotFoundPath is the output path of the 404 page, served by both Cloudflare Pages and GitHub Pages from the output root.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache keeps parsed Markdown between builds, keyed by source path and the SHA-256 of the file. tryck dev uses one Cache for all rebuilds so unchanged pages skip goldmark parsing. A Cache is tied to one config: create a new one when the config changes.
Cached ASTs are only modified in stage 2 of a build, and only by link rewriting, which re-applies from the original destinations each time. One build at a time may use a Cache.
type Options ¶
type Options struct {
Dev bool // building for tryck dev
Logger *slog.Logger // debug logs with per-stage timings; nil = silent
Plugins []plugin.Plugin // compiled-in plugins in addition to the built-ins
Cache *Cache // parsed pages reused between builds; nil = none
}
Options adjust a build.
type Site ¶
type Site struct {
Config *config.Config
Pages []*content.Page // sorted by URL
ByURL map[string]*content.Page
Anchors map[string]map[string]struct{} // URL -> set of element IDs
Assets []content.Asset // files from contentDir copied next to pages
Outputs map[string][]byte // output path -> bytes (pages + generated files)
Diags []diag.Diagnostic // sorted
BuiltAt time.Time
}
Site is the result of a build. It is not modified after Build returns.