Core
Views and static files
Eta templates, the it.w helpers, and how files in app/public are served and cached.
#Templates
Available in every view as it.w.*. it.path is the current URL path.
| Helper | Example | Result |
|---|---|---|
date(value, options?) |
it.w.date(post.date) |
November 16, 2026 |
number(value, options?) |
it.w.number(1234.5) |
1,234.5 |
truncate(text, length?, tail?) |
it.w.truncate(post.body, 140) |
cut at a word |
classes(...parts) |
it.w.classes('btn', { 'btn--big': big }) |
btn btn--big |
active(current, href, { exact }?) |
it.w.active(it.path, '/blog') |
true on /blog/post |
slug(text) |
it.w.slug('Crème brûlée') |
creme-brulee |
json, url, asset |
see the example site | safe embedding, safe links, cache busting |
date and number follow locale in white.config.js (default 'en').
#Static files and caching
Files in app/public are served with compression and caching. it.w.asset('/css/app.css') adds a content hash (/css/app.css?v=3f2a9c1d7e); in production a file requested with such a hash is sent as Cache-Control: public, max-age=31536000, immutable, since its URL changes whenever its content does. Other files use static.maxAge. In development nothing is cached.
export default {
static: { maxAge: '7d', versioned: '365d' }, // false: serve no static files
compression: true, // false: off (a CDN or proxy compresses); an object goes to the middleware
};