Skip to main content

load_extra_theme_templates

Function load_extra_theme_templates 

Source
pub(crate) fn load_extra_theme_templates(
    tera: &mut Tera,
    theme_path: &Path,
    skip: &[&str],
) -> Result<()>
Expand description

Scans theme_path for any *.j2 files whose stem (the name without the .j2 suffix, e.g. "base.html") is not already listed in skip, and loads each one into tera under that stem name.

This makes user-supplied helper or base templates — e.g. a base.html.j2 referenced by {% extends "base.html" %} in a customised main template — available at render time without the caller needing to enumerate them.