Core reference
Page & build metadata with $[...].
$[...] exposes the page and build information Nift already has while processing a tracked file. The names below are the complete set recognised by the v4 parser.
Page metadata
| Syntax | Value |
|---|---|
$[title] | The tracked title. |
$[name] | The tracked name. |
$[content-path] | The content file path. |
$[output-path] | The generated output path. |
$[template-path] | The template file path. |
Build metadata
| Syntax | Value |
|---|---|
$[build-timezone] | The build timezone. |
$[build-time] | The current local build time. |
$[build-UTC-time] | The current UTC build time. |
$[build-date] | The current local build date. |
$[build-UTC-date] | The current UTC build date. |
$[build-YYYY] | The four-digit build year. |
$[build-YY] | The two-digit build year. |
$[build-OS] | The operating system reported for the build. |
Metadata names are matched exactly by the parser, including hyphens and capitalisation in names such as build-UTC-time, build-YYYY and build-OS.
Examples
<title>My site — $[title]</title>
<body data-page="$[name]">
@content
</body>
<small>Built $[build-date] at $[build-time]</small>
Useful while building or debugging
<!-- built from $[content-path] using $[template-path] -->
<!-- output: $[output-path] -->Comments like these can be handy temporarily when converting a large existing site or checking which tracked item produced a generated file.
$[...] is intentionally small: it exposes facts Nift already knows about the current tracked item and build. Use ordinary project files or external tooling for richer application data.
Practical examples
Use the tracked title in the document head
<title>$[title] · Nift</title>
Expose build information in a footer
<small>Built $[build-date] on $[build-OS]</small>
Leave useful diagnostics while designing a template
<!--
tracked name: $[name]
content: $[content-path]
template: $[template-path]
output: $[output-path]
-->
Those comments can be useful while developing a complicated template hierarchy and removed when you no longer need them.
Local time and UTC
Nift exposes both local and UTC build values so generated metadata can use whichever convention your deployment or content format expects. For example, a human-facing footer might use local build time while machine-oriented generated text uses UTC.