LinuxCommandLibrary

zola

Generate static websites and blogs

TLDR

Create the directory structure used by Zola at the given directory

$ zola init [my_site]
copy

Build the whole site in the public directory after deleting it
$ zola build
copy

Build the whole site into a different directory
$ zola build --output-dir [path/to/output_directory]/
copy

Build and serve the site using a local server (default is 127.0.0.1:1111)
$ zola serve
copy

Build all pages just like the build command would, but without writing any of the results to disk
$ zola check
copy

SYNOPSIS

zola <SUBCOMMAND> [OPTIONS]

Common Subcommands:
zola init: Initializes a new Zola project.
zola build: Builds the static site.
zola serve: Serves the site locally for development with live reloading.
zola check: Checks the site for common issues.
zola highlight: Highlights a code file to standard output.
zola shell: Spawns a shell with `zola` variables set (useful for themes).

PARAMETERS

--config <FILE>
    Path to the configuration file. Defaults to `config.toml` in the current directory.

--root <DIR>
    Path to the root directory of the Zola project. Defaults to the current working directory.

--base-url <URL>
    Base URL for the site. Often used during build or for testing different environments.

--output-dir <DIR>
    Directory to output the static files. Defaults to `public/` within the project root.

--drafts
    Include drafts when building or serving the site. Drafts are typically ignored by default.

--force
    Force operations that might otherwise be prevented, e.g., overwriting existing directories during init.

--port <PORT>
    Specify the port for the development server (used with serve subcommand). Defaults to 1111.

--interface <IP>
    Specify the interface/IP address for the development server to bind to (used with serve subcommand). Defaults to `127.0.0.1`.

--open
    Automatically open the site in your default browser after starting the development server (used with serve subcommand).

--watch-only
    Only watch for changes without serving the site (used with serve subcommand).

DESCRIPTION

Zola is a powerful, fast, and opinionated static site generator written in Rust. Unlike dynamic content management systems, Zola compiles all content (Markdown files, templates, assets) into static HTML, CSS, and JavaScript files, ready to be served by any web server. It emphasizes performance and simplicity, requiring only a single binary for operation. Zola supports common web development features out-of-the-box, including Markdown for content, Tera (Jinja2-like) for templating, Sass for CSS preprocessing, image processing, syntax highlighting, and a built-in development server. Its strong conventions guide users towards best practices, making it efficient for blogs, portfolios, and documentation sites. Zola's speed, due to its Rust implementation, is a major advantage for large projects.

CAVEATS

Zola is not a standard Unix-like command found in most minimal Linux installations; it needs to be explicitly installed. Its functionality is entirely focused on static site generation and requires a specific project structure (e.g., `content`, `templates`, `static` directories) and a `config.toml` file. While fast, large sites with complex templating or many images can still take time to build. It's opinionated, which can be a strength for speed and best practices but a limitation for highly customized or non-standard workflows.

TYPICAL WORKFLOW

The typical workflow with Zola involves initializing a new project with zola init, creating content in Markdown files, designing templates using Tera, configuring the site with config.toml, previewing changes locally with zola serve, and finally building the static output for deployment using zola build.

CONFIGURATION

Zola relies heavily on its configuration file, typically named config.toml, located at the root of the project. This file defines global settings, such as the site's base URL, title, description, taxonomies, and various build options. Sub-configurations can also be defined within content files (front matter) or individual template files.

HISTORY

Zola was created by Vincent Prouillet (known as Keats) and first released around 2018. It was developed in Rust with a primary focus on performance and simplicity, aiming to be a fast, all-in-one solution for static site generation. It quickly gained popularity as an alternative to more established SSGs like Jekyll and Hugo, particularly appealing to developers who appreciate Rust's safety and speed, and those looking for a single-binary solution without external dependencies like Node.js or Ruby. Its development has been consistent, with new features and optimizations regularly added by the community.

SEE ALSO

hugo(1), jekyll(1), eleventy(1), nginx(8), apache2(8)

Copied to clipboard