Docula lets you override individual template files from a built-in template without replacing the entire template. This is useful when you want to customize specific parts of a template (such as the footer, sidebar, or header) while keeping the rest of the default template intact.
Table of Contents
How It Works
Place your override files in a templates/{templateName}/ directory inside your site folder. The directory structure mirrors the built-in template. Any file you include will replace its corresponding file in the built-in template during the build.
For example, if you are using the modern template and want to customize the footer:
site/
templates/
modern/
includes/
footer.hbs # overrides the built-in modern/includes/footer.hbs
docs/
index.md
docula.config.ts
Overridable Files
You can override any file in the built-in template, including:
Top-level templates:
home.hbs— Landing pagedocs.hbs— Documentation pageapi.hbs— API reference pagechangelog.hbs— Changelog listing pagechangelog-entry.hbs— Individual changelog entry page
Includes (partials):
includes/header.hbs— Page header/meta tagsincludes/header-bar.hbs— Sticky header navigation barincludes/footer.hbs— Page footerincludes/sidebar.hbs— Navigation sidebarincludes/doc.hbs— Document content wrapperincludes/hero.hbs— Hero sectionincludes/home.hbs— Home page contentincludes/scripts.hbs— Page scriptsincludes/theme-toggle.hbs— Light/dark theme toggle
Assets:
css/— Stylesheet filesjs/— JavaScript files
The available includes vary by template. Check the templates/ directory in the Docula repository for the complete list of files in each template.
Example: Custom Footer
- Create the override directory structure:
mkdir -p site/templates/modern/includes
- Create your custom footer at
site/templates/modern/includes/footer.hbs:
- Build your site as usual:
npx docula build
During the build, Docula will log which files are being overridden:
▶ Applying template overrides...
ℹ Template override: includes/footer.hbs
Notes
- Built-in templates only — Partial overrides work with the
templateoption (e.g.,modern,classic). If you usetemplatePathto provide a fully custom template, overrides are not applied since you already control the entire template. - Cache directory — Docula merges overrides into a
.cache/templates/{templateName}/directory inside your site folder. This directory is automatically managed and only rebuilt when override files change. Use--cleanto remove it along with the output directory. - Automatic .gitignore — When the
.cachedirectory is first created, Docula automatically adds.cacheto your site folder's.gitignore(creating the file if needed). SetautoUpdateIgnores: falsein your config to disable this behavior. - Any file can be overridden — The override directory structure mirrors the built-in template exactly. Any file you place in the override directory replaces the corresponding file from the built-in template.