Appearance
Site settings
Two files at the root of the site's frontend code hold settings that travel with each code release: site.yaml and query.yaml. Both are validated when the code release is prepared: an invalid file refuses the release and names the problem. Neither file is ever served. A change takes effect when the code release that holds it goes live, and a code rollback takes it back.
site.yaml
yaml
version: 1
authoring: blocks-v3
delivery:
assetPrefix: /news/_fw
csp: strict
links:
external:
- /about
- /shop/**
head:
fields: [topic_title, number]| Key | Default | Meaning |
|---|---|---|
version | required | Always 1. |
authoring | none | The default dialect of the site's pages (blocks-v2, blocks-v3). Front matter overrides it per page. |
delivery.assetPrefix | none: code at /code/…, images at /media/… | The path under which live pages name their code and images, such as /news/_fw. Lower-case segments; the last one starts with _, which no page path can, so the prefix never hides a page. It cannot start with a reserved prefix such as /code or /media. |
delivery.csp | off | strict: live pages send a Content-Security-Policy that allows the page's own host and the hash of its import map. See below. |
links.external | none | Path globs of pages another system serves on the same host. Links to them are not reported as CONTENT_LINK_UNKNOWN_PATH. Same glob grammar as query.yaml: * within a segment, ** for whole segments, at most 200 globs. |
blocks | none | For an app that embeds the site's pages (@foliwake/next): entry (the blocks module, such as scripts/blocks.js), contract (the blocks contract major, 2) and eventPrefix. It goes into the descriptor the engine generates from the block folders, and every .plain.html answer names it in X-Foliwake-Blocks. A site with a hand-written components/components.json names it there instead (both is an error). |
| head.fields | none | Page fields (front matter or a path mapping rule's metadata) that every page names in its <head>, so the site's scripts can read them: see below. At most 32 page field names; title, description, lang, template, id, path and authoring are not page fields. |
Any other key refuses the code release.
delivery.assetPrefix
With a prefix, live pages link their stylesheets, scripts, import map and component styles as <prefix>/code/<release>/…, and every image, video poster and file link that names a published file as <prefix>/media/<hash>.<ext>. The stored pages do not change: the delivery service rewrites the URLs when it sends a page. Plain bodies (.plain.html) and preview keep the default form, so applications that embed pages keep reading the URLs they know.
The delivery service answers both forms, with or without any prefix, so the setting needs no other configuration: route <prefix>/* to the delivery service at your CDN, and the old system keeps /code/ and /media/ if it uses them.
delivery.csp
strict sends this policy on every live page:
text
default-src 'self'; script-src 'self' 'sha256-<import map>'; style-src 'self' 'unsafe-inline';
img-src 'self' data: [the page's image CDN]; font-src 'self'; connect-src 'self'; media-src 'self';
object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'self'The import map's hash changes with every code release, which is why a CDN rule cannot hold it. It is off by default: the policy blocks any script, style, font or embed from another host that a site's code may load today. Turn it on once the site's code loads only from its own host. If your CDN adds its own policy to every path of the host, exclude the paths of the delivery service from it.
Who does what for delivery
Both settings stay in the site's code: the pages' markup depends on the prefix, and the policy on what the code loads, so a code rollback takes them back together. Each has a half outside Foliwake that the operator of the CDN or proxy keeps in step:
| Setting | The site's code declares | The operator does |
|---|---|---|
delivery.assetPrefix | the path its live pages name for code and images (/news/_fw) | routes <prefix>/* on the live host to the delivery service (Foliwake's live origin or the Worker origin) before the release that turns it on; keeps /code/ and /media/ routed while older pages may name them |
delivery.csp | strict: the policy each live page sends | keeps any CDN-wide Content-Security-Policy off the delivery service's paths, so the page's own policy is the one the browser gets |
head.fields
Page fields carry no meaning for the engine; by default they reach only query indexes. A site whose scripts need some of them on the page itself lists them here. Each page then has, after its description, one <meta> per field it has, in the order of the list:
html
<meta name="foliwake:field:topic_title" content="Уход за грядками">
<meta name="foliwake:field:number" content="4.6">The content is the field's text, HTML-escaped. A list field gives one tag per item, in list order. A page without the field gives no tag, so a script reads document.querySelector('meta[name="foliwake:field:number"]')?.content and handles undefined. With a path mapping such as {topic_order}. {topic_title} [{topic}]/{order}. {*} [{subtopic}]/lesson/{lang}.md, renaming a folder changes the field, and so the page: publish it again.
Live, preview, branch previews, the author's view and foliwake dev all write the tags. They are composed when a page is served, from the fields stored with the page and the list in the code release that view serves (live code for live and the author's view, the branch's code for its preview; foliwake dev reads the local site.yaml), so changing the list needs a code release, never a republish. Embedded bodies (.plain.html) have no <head>: an app reads the fields from a query index instead.
Every delivery service that serves the site must know the key before a code release uses it: an older engine refuses the code release, and an older Worker origin answers 503 for the site's pages, since it reads site.yaml too. Update the engine and the Worker first.
query.yaml: sitemap.target
yaml
sitemap:
source: news
target: /news/sitemap.xmltarget is the path the sitemap is served at; without it, /sitemap.xml. It must end in .xml, be lower case and stay outside the reserved prefixes. The sitemap's addresses use the origin set in the site's sitemap.origin setting.
The site's public address
The site setting liveUrl (in foliwake.config.json; on the Cloudflare Worker, the variable LIVE_URL) is the public address of live, such as https://www.example.com. With it, every live page links its canonical address, <link rel="canonical" href="https://www.example.com/<page path>">, and a page with a lang in its front matter also links itself as its hreflang alternate.
On a server, an organisation admin sets liveUrl only on the site's own managed live host; another domain is set by the installation's owner (what an organisation admin may change).
