Kalenuxer Guide

Template System

How Kalenuxer handles HTML templates — include directives, template files, and the page and template hierarchy.

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.

HTML — using include directives
!main_tags!

<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
!main_tags! 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.

Source file locations
site/html/main/pages/home.kalenux.html
site/html/main/pages/about.kalenux.html
site/html/main/products/product/kalenuxer.kalenux.html
site/html/main/products/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:

Template file path
site/template/main/general/main_header.kalenux.html

And !main_tags! resolves to:

Template file path
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.

Note: When you edit a template file, the build will trigger a rebuild for every page that includes it on the next run. This ensures all pages stay in sync with template changes.

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.

site/template/main/general/main_header.kalenux.html
<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.

Want a custom build pipeline?

We can design and implement custom build and deployment systems tailored to your specific stack and workflow requirements.