Audrey M. Roy Greenfeld

Quietly building the future.

Zola: Rust-Based Static Site Generator

2024-05-20

This is my first blog post using Zola. It's a Rust-based static site generator.

I like how it goes beyond just blogging, allowing me to create other website sections.

Let's see how Zola handles code snippets. Here's a Rust snippet:

use tera::{Tera, Context};

fn main() {
    let mut tera = Tera::default();
    tera.add_raw_template("hello.html", "<h1>Hello {{ name }}</h1>").unwrap();

    let mut context = Context::new();
    context.insert("name", "Tera");

    let rendered = tera.render("hello.html", &context).unwrap();
    println!("{}", rendered);
}

Python:

def hello(name):
    return f"Hello {name}"

Zola was created by Vincent Prouillet in 2017. He also wrote the Tera template engine in 2016, which Zola uses. Both are excellent projects.

There's a GitHub action to deploy a Zola site to GitHub Pages: Zola Deploy to Pages.