Page data
Every page has one data object, exposed as page in JSX and Go templates and
returned for each page by pages(). Frontmatter, data() calls, defaults, and
taragen's own keys all write into this same object.
Where data comes from
Data is filled in this order, and later writers win:
- Taragen seeds
pathandslug(andparamsfor generated pages), and setsoutputs. _defaults.jsxfiles, from the site root down to the page's folder.- The page itself: YAML frontmatter in Markdown and templates, or
data({...})in JSX. -
Layouts, while rendering: frontmatter in template layouts,
data()in JSX layouts.
After every page is parsed, taragen sets links and backlinks on every page.
Built-in keys
Any key you set that isn't listed here is yours: title, description, tags,
and so on flow through untouched. These keys have built-in meaning:
| Key | Set by | Meaning |
|---|---|---|
path |
taragen | The page's URL path, such as /articles/2021/ngrok. |
slug |
taragen | The last segment of the path, such as ngrok. |
src |
taragen | The raw page source (for generated pages, the template's source). |
body |
taragen | The page's rendered body, before layouts. |
isDir |
taragen | True for folders and index.* files. |
subpages |
taragen | In pages() results: the page's children, sorted, each with its own subpages. |
params |
taragen | Generated pages only: the parameter values, such as { year: "2026", month: "11" }. |
outputs |
you, then taragen | You set it to turn outputs off; taragen replaces it with a map of output name to URL. See Extra outputs per page . |
links |
taragen | Sorted list of the site pages this page's body links to. |
backlinks |
taragen | Pages whose bodies link to this page. See Backlinks. |
aliases |
you | Old URLs that redirect to this page. Taragen replaces it with the normalized list. See Aliases and redirects . |
siteURL |
you | The site's absolute origin, such as https://example.com. Used to recognize absolute links to your own pages, and handy for building absolute URLs in feeds and meta tags. |
layout |
you | Layout path to use instead of the folder layouts, such as _blog/_layout. "" turns layouts off. |
date |
you | YYYY-MM-DD. Orders listings; a future date makes the page a draft. |
draft |
you | true makes the page a draft. |
contentType |
you | The HTTP Content-Type in serve. Defaults to text/html. |
preamble |
you | Text written before the output. Defaults to <!DOCTYPE html> for HTML. |
Keys set by taragen replace whatever a page sets for them. Avoid using outputs, links, backlinks, aliases, or params for your own data.