Include directives
Kalenuxer uses a simple include syntax to pull reusable template fragments into pages. Any directive in a source file is replaced with the content of the corresponding template file at build time.
Template System - Kalenuxer Framework <link rel="stylesheet" href="/css/main/pages/home.css"></head><body><main> <!-- page content --> </main> </body></html>
The three most commonly used directives across all Kalenuxer pages are:
| Directive | What it injects |
|---|---|
| The <html> open tag, full <head> with meta, OG, and schema tags populated from JSON data. |
| The site-wide navigation header. |
| The site-wide footer including scripts and cookie consent. |
Page files
Page files are the HTML source files that map to output URLs. They live under site/html/ and follow a directory structure that mirrors the desired output URL paths.
site/html/main/pages/home.kalenux.htmlsite/html/main/pages/about.kalenux.htmlsite/html/main/products/product/kalenuxer.kalenux.htmlsite/html/main/products/product/kalenuxer/getting-started.kalenux.html
Page files contain the unique content for each route. They use include directives to bring in shared template fragments and variable references to pull in text from the language JSON files.
Template files
Template files are reusable HTML fragments stored under site/template/. When the build encounters an include directive, it looks for the corresponding file using the directive name as the path.
For example, resolves to:
site/template/main/general/main_header.kalenux.html
And
resolves to:
site/template/main/general/main_tags.kalenux.html
Template files themselves can contain variable references and other include directives. They are processed with the same variable substitution engine as page files.
URL mapping
The directory path of a page source file maps directly to the output URL. The home page is a special case that maps to the root index:
| Source file | Output file | URL |
|---|---|---|
site/html/main/pages/home.kalenux.html | dist/release/index.html | / |
site/html/main/pages/about.kalenux.html | dist/release/about.html | /about |
site/html/main/products/product/foo.kalenux.html | dist/release/product/foo.html | /product/foo |
site/html/main/products/product/foo/guide.kalenux.html | dist/release/product/foo/guide.html | /product/foo/guide |
The .kalenux.html extension
All source files that are processed by Kalenuxer must use the .kalenux.html double extension. This allows the build system to distinguish source files from any static HTML files that should be copied directly without processing.
The .kalenux.html extension is stripped in the output. A file named about.kalenux.html becomes about.html in dist/.
Nesting templates
Templates can include other templates. The build resolves includes recursively, so a header template can itself include a navigation sub-template, which can include a dropdown sub-template, and so on.
<header class="site-header"> </header>
There is no enforced limit on nesting depth, but circular includes will cause the build to hang. Keep template hierarchies shallow and intentional to avoid this.