getzola/zola · error

Theme `{}` is missing a templates folder

Error message

Theme `{}` is missing a templates folder

What it means

`load_tera` in components/templates validates the theme layout. When `config.theme` is set, it requires `themes/<theme>/templates/` to exist; if it does not, it bails naming the missing theme. Themes in Zola must ship a templates folder to be loadable.

Source

Thrown at components/templates/src/lib.rs:135

    tera.set_fallback_prefixes(fallback_prefixes)?;

    // Register filters/tests/functions from ZOLA_TERA
    tera.register_from(&ZOLA_TERA);

    // Add builtin templates
    for (name, content) in BUILTIN_TEMPLATES {
        templates.push((name.to_string(), content.to_string()));
    }

    // Validate theme exists if configured
    let site_tpl_dir = path.join("templates");
    let theme_tpl_dir =
        config.theme.as_ref().map(|t| path.join("themes").join(t).join("templates"));

    if let Some(ref theme_dir) = theme_tpl_dir
        && !theme_dir.exists()
    {
        bail!("Theme `{}` is missing a templates folder", config.theme.as_ref().unwrap());
    }

    if !site_tpl_dir.exists() && theme_tpl_dir.is_none() {
        bail!("Either a `templates/` folder or a theme is required");
    }

    // Load theme templates first (lower priority)
    if let Some(ref theme) = config.theme {
        let pattern = format!(
            "{}/themes/{theme}/templates/**/*.{{html,xml,md,txt,json,ics}}",
            glob_base(path)
        );
        for (file_path, name) in tera::load_from_glob(&pattern)? {
            // "page.html" → "sample/templates/page.html"
            let name = format!("{theme}/templates/{name}");
            let content = fs::read_to_string(&file_path)
                .with_context(|| format!("Failed to read '{}'", file_path.display()))?;
            templates.push((name, content));

View on GitHub (pinned to 61d3082821)

Solutions

  1. Clone or copy the theme so `themes/<theme>/templates/` exists
  2. Verify the theme name in config.toml exactly matches the folder name in `themes/`
  3. Check the theme repository actually contains a `templates` directory (update the theme if it moved)

Example fix

// before
# config.toml: theme = "hyde"  (themes/hyde missing)
// after
$ git clone https://github.com/getzola/hyde themes/hyde
# themes/hyde/templates/ now exists
Defensive patterns

Strategy: validation

Validate before calling

if let Some(theme) = &config.theme {
    assert!(Path::new("themes").join(theme).join("templates").is_dir(), "theme '{theme}' missing templates/");
}

Try / catch

match load_tera(base_path, &config) {
    Ok(t) => use(t),
    Err(e) if e.to_string().contains("is missing a templates folder") => {
        eprintln!("install the theme: git clone <theme-url> themes/<name>");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Setting `theme = "name"` in config.toml while `themes/name/templates/` does not exist — theme not installed/cloned, wrong theme name, or theme repo lacking a `templates` directory.

Common situations: Forgetting `git clone` of the theme into `themes/`; typo in the theme name in config.toml; using a theme version that restructured its directories; cloning the theme repo into a differently named folder.

Related errors


AI-assisted analysis of getzola/zola@61d3082821 (2026-09-03). Data as JSON: /api/errors/1df6a78d49ed1cf7. Report an issue: GitHub.