diff --git a/404.html b/404.html index 9240eb5..7d18045 100644 --- a/404.html +++ b/404.html @@ -25,7 +25,7 @@ }; })(); -
Tempblot treats your input directory as a source tree. Static files are copied as-is, and .blot files are compiled into output files by removing the .blot extension.
.blot
Use .blot when a file needs TypeScript-powered templating. Leave everything else as a normal static file.
package.json
README.md
Given that input tree, generating into dist produces this output shape:
dist
Each regular .blot file should include one <output> block. Add <setup> only when the template needs imports, params, helper functions, or computed values.
<output>
<setup>
<setup>const name = "tempblot";</setup> +<output lang="json">{ "name": <<JSON.stringify(name)>>}</output>
Put bracketed params in a .blot file name to generate one output file for each path entry. The same file provides both the getPaths() function and the output template.
getPaths()
[slug].json.blot
<setup>export function getPaths() { return [{ slug: "hello-world" }, { slug: "release-notes" }];}</setup> +<output lang="json">{ "slug": <<JSON.stringify(slug)>>}</output>
The generated output keeps the surrounding directory structure and replaces [slug] with each returned value.
[slug]
Put bracketed params in a directory name when a whole folder should be generated more than once. Add a _paths.blot file inside that directory to describe the path entries for the directory.
_paths.blot
[section]
Path files are the exception to the regular .blot shape: _paths.blot should contain exactly one <setup> block and no <output> block.
<setup>export function getPaths() { return [{ section: "guides" }, { section: "reference" }];}</setup>
Every file inside [section] is generated once for each returned path entry.