Skip to content

Configuration

Configure your Balzac project using a balzac.toml file.

Create a balzac.toml file in your project root:

[global]
site_name = "My Site"
author = "Your Name"
output_directory = "./dist"
pages_directory = "./pages"
layouts_directory = "./layouts"
partials_directory = "./partials"
assets_directory = "./assets"
content_directory = "./content"

Data available in all templates:

[global]
site_name = "My Site"
site_url = "https://example.com"
author = "Your Name"

Access in templates:

<h1>{{site_name}}</h1>
<p>By {{author}}</p>

Configure build hooks:

[hooks]
render_init_before = "echo 'Preparing renderer'"
render_init_after = "echo 'Renderer ready'"
build_before = "pnpm build"
render_before = "echo 'Starting page generation'"
render_after = "echo 'Pages generated'"
build_after = "rsync -av dist/ production/"

See Hooks Reference for details.

Enable Vite bundler for JavaScript/CSS:

[bundler.vite]
enabled = true
manifest_path = "dist/.vite/manifest.json"

When enabled, use the {{vite_url}} helper in templates:

<script src='{{vite_url "main.js"}}'></script>
[global]
site_name = "My Awesome Site"
site_url = "https://example.com"
author = "John Doe"
description = "A blog about Rust and web development"
[hooks]
build_before = "pnpm build"
[bundler.vite]
enabled = true
manifest_path = "dist/.vite/manifest.json"

All configuration options have sensible defaults:

OptionDefault
output_directory./dist
pages_directory./pages
layouts_directory./layouts
partials_directory./partials
assets_directory./assets
content_directory./content
globalnull
hooksnull
bundler.vite.enabledfalse
bundler.vite.manifest_pathdist/.vite/manifest.json

Balzac does not currently support environment variables in configuration. Use hooks to inject environment-specific data if needed.