Missing template
error An error stops the build: nothing is published until it is fixed.
A page needs a template that templates/ doesn’t have. The message names
the file Statac looked for.
A page is built with the first of these:
- the template its own
layout:names, aslayout: post; - the template its
type:names, wheretemplates/has one; - a
layout:handed down from its folder orstatac.yaml, aspages.layout: post, unless the page speaks for a list; homefor the home page,folderfor any other page that speaks for a list, andpagefor the rest.
A template’s {% extends "base" %} names another the same way. Each name
is the file’s name in templates/ without .html.
What you’ll see
error Missing template: there is no `templates/folder.html`
Add the template, or choose another with `layout:`.
More: https://statac.dev/e/missing-template/
In the terminal the message also names the file and line where there is one, and marks the exact text.
Why Statac stops
With no template, there is nothing to build the page with.
How to fix it
Add the template to templates/, or correct the name. When a template with
a similar name is there, Statac offers it. To build a page with another
template, write layout: on the page, or pages.layout: on its folder’s
index.md.
Example
In content/posts/index.md:
---
pages.layout: psot
---
If the file is templates/post.html, write:
---
pages.layout: post
---
Its name
| Name | missing-template |
|---|---|
| In the terminal | statac explain missing-template |
| To stop showing it | It stops the build, so it can't be quietened. |
Something unclear or wrong? Open an issue on GitHub.