Appearance
Page templates
A template gives a group of pages their own stylesheet, script and list of allowed blocks: every lesson looks like a lesson, every catalog page like a catalog page. Templates are optional. A site with none works as before, and most pages of a site with templates need none.
A page without a template
This is the normal case. The page gets the site's styles/styles.css, and its blocks load through scripts/components.js. <path>.plain.html is always the page body alone, with or without a template, so an app that embeds pages never sees one.
What a template is
A folder in the site code, released with the code release like blocks:
text
templates/lesson/lesson.json the definition (required)
templates/lesson/lesson.css optional
templates/lesson/lesson.js optional, a plain modulejson
{ "label": "Lesson", "blocks": ["scene", "note"], "paths": ["/lessons/**"] }label: for people.blocks(optional): the site blocks a page with this template may use. Left out: all of them;[]: none.paths(optional): a guard, explained below.
How a page gets its template
Only the page names it, in one of two places:
- its front matter:
template: lesson; - the path mapping rule of its source that matched its file:
"metadata": { "template": "lesson" }. One line in the rule covers every page it matches.
When both give one, the front matter wins. A page that names nothing has no template, whatever its path.
Sources that cannot write front matter (Google Docs, Drupal) use the rule.
paths is only a guard
paths never gives a page a template, and never requires one. It only checks that the template is not used where it does not belong: a page that names lesson at /about is TEMPLATE_PATH when lesson.json says "paths": ["/lessons/**"]. Leave paths out to allow any path.
Several templates may cover the same path; Foliwake never picks one for a page.
Before November 2026 a page on a template's paths that named no template was an error (TEMPLATE_MISSING), so paths decided as much as the page did. That rule is gone, with no exceptions: the page alone decides.
Errors
| Code | When |
|---|---|
TEMPLATE_UNKNOWN | The page names a template the code release does not have. Code that drops a template live pages use is refused when it is rolled out. |
TEMPLATE_PATH | The template has paths and the page is outside them. |
TEMPLATE_BLOCK | The page uses a block the template's blocks does not allow. |
foliwake page check and foliwake dev show them with the line of the file. Publication and code rollout check every page against the code it goes live with; the preview host checks the page it serves, and a branch preview the whole preview.
What changes in the page HTML
Without a template:
html
<html lang="en" data-html-contract="2">
<head>
<link rel="stylesheet" href="/code/<cd>/styles/styles.css">
<script type="module" src="/code/<cd>/scripts/components.js"></script>With template: lesson (both files present):
html
<html lang="en" data-html-contract="2" data-template="lesson">
<head>
<link rel="stylesheet" href="/code/<cd>/styles/styles.css">
<link rel="stylesheet" href="/code/<cd>/templates/lesson/lesson.css" data-template-css>
<script type="module" src="/code/<cd>/scripts/components.js"></script>
<script type="module" src="/code/<cd>/templates/lesson/lesson.js"></script>The body is the same. The template stylesheet comes after the site's and before the block stylesheets.
Example: lessons, handbook and question lists
One Drive folder per lesson holds lesson/ru.md, handbook/ru.md and questions.md. Only the lesson pages use the lesson template, and the rule says so once:
json
"mappings": [
{ "match": "{*} [{topic}]/{*} [{subtopic}]/lesson/{lang:ru|en|ka}.md",
"path": "/lessons/ge/{topic}/{subtopic}/{lang}",
"metadata": { "lang": "{lang}", "template": "lesson" } },
{ "match": "{*} [{topic}]/{*} [{subtopic}]/handbook/{lang:ru|en|ka}.md",
"path": "/handbook/ge/{topic}/{subtopic}/{lang}",
"metadata": { "lang": "{lang}" } },
{ "match": "{*} [{topic}]/{*} [{subtopic}]/questions.md",
"path": "/lessons/ge/{topic}/{subtopic}/questions",
"metadata": { "title": "Exam questions" } }
]The handbook chapter and the question list are ordinary pages: they name no template, even though the question list lives under /lessons/. lesson.json can keep "paths": ["/lessons/**"] as a guard against naming lesson anywhere else, or drop it.
Compared to Adobe EDS
In Edge Delivery Services the template is page metadata too (Template in the page's metadata block, or set for a folder or by URL pattern in bulk metadata), and the site code reads it from <meta name="template">. Nothing checks it: a misspelled template silently gives a plain page. In Foliwake the template is set per page or per mapping rule, and the code release is checked against it: an unknown template, a page outside the template's paths or a block the template does not allow is reported before the page goes live.
