Zola

Fast static site generator written in Rust. Single binary with no runtime dependencies. Uses Tera templates, built-in Sass, syntax highlighting, and full-text search.

Project structure

my-site/
├── config.toml
├── content/          # Markdown pages and sections
│   ├── _index.md     # section front matter
│   └── blog/
│       ├── _index.md
│       └── first-post.md
├── templates/        # Tera templates
│   ├── base.html
│   ├── index.html
│   └── page.html
├── static/           # copied as-is to output
├── sass/             # compiled to CSS
└── themes/

Commands

zola init my-site     # scaffold a new site
zola serve            # dev server with live reload
zola build            # build to ./public
zola check            # check links and templates

config.toml

base_url = "https://example.com"
title = "My Site"
theme = "mytheme"
compile_sass = true
build_search_index = true
 
[markdown]
highlight_code = true
highlight_theme = "base16-ocean-dark"
 
[extra]
# custom variables accessible in templates

Content front matter

+++
title = "My Post"
date = 2024-01-15
draft = false
[taxonomies]
tags = ["rust", "web"]
+++
 
Content here in Markdown.

Tera templates

{% extends "base.html" %} {% block content %}
<h1>{{ page.title }}</h1>
{{ page.content | safe }} {% for post in section.pages %}
<a href="{{ post.permalink }}">{{ post.title }}</a>
{% endfor %} {% endblock %}

Shortcodes

Define in templates/shortcodes/, call in content:

{{ youtube(id="dQw4w9WgXcQ") }}