Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Child Themes

A child theme names a parent in its config and uses the parent’s templates for the ones it lacks.

name: Acme child
parent: acme
let child = store::create_child_theme(&db, "acme", "acme-child", "Acme child").await?;
KeyTypeDefaultMeaning
parentstringnoneThe theme whose templates fill in for the ones this theme lacks.
LookupResult
A template by kind and pathThe theme’s own, else the nearest ancestor’s.
A page’s layoutAny layout of the theme or its ancestors.
The settings formThe theme’s own, else its parent’s; the values are each theme’s own (see Theme Settings).

Resolve a template through the chain

// Through the parent chain: the theme's own row, else the nearest ancestor's.
if let Some((from, template)) = store::resolve_template(&db, "child", Kind::Layout, "default.htm").await? {
    println!("{} from {}", template.path, from.code);
}

let chain = store::chain(&db, "child").await?;

Change or remove a parent

store::update_theme_config(&db, "acme-child", "name: Acme child\nparent: base\n").await?;
CallRefused when
create_themeThe parent is missing or leads back to the theme.
update_theme_configThe theme is locked, or the parent is missing or leads back.
delete_themeThe theme is another theme’s parent.

The other calls are under Themes.