published 2020-05-23
Zola is a static site generator. I started using it recently for a couple of my sites that don't require a web application:
The "getting started" instructions for Zola are very easy to follow; in a short time it was possible install Zola, create a new project, and write a simple set of templates and configure the site with these templates. The templating engine, tera, is very similar to jinja2 and others like it.
Getting started with Zola locally is simply a matter of opening a terminal and typing
cd path/to/empty-project
zola init
zola serve
Syntax highlighting is built into Zola, which makes it possible to add code blocks like the above and have them highlighted in the language indicated.
Each site is a separate git repository. Because I host most of my private git repositories on GitLab, I decided to host these sites on GitLab pages and automatically deploy them with GitLab CI. Here is the .gitlab-ci.yml
file for seanharrison.org:
variables:
ZOLA_VERSION: "v0.11.0"
pages:
script:
# download zola
- curl -L https://github.com/getzola/zola/releases/download/$ZOLA_VERSION/zola-$ZOLA_VERSION-x86_64-unknown-linux-gnu.tar.gz > zola.tar.gz
- tar -xzf zola.tar.gz
# build the site, output is in ./public
- ./zola build
artifacts:
# Tell GitLab pages the site is in ./public
paths:
- public
only:
# only on the master branch
- master
Even though GitLab CI doesn't come with Zola installed, it's simple to install it as part of the CI script, as the above code block shows.
Zola is fast. Building an entire site with several pages, fonts, and media files takes less than a second on GitLab CI (the whole CI process can take a minute, but nearly all of that time is spent setting up the CI environment). Zola's speed is important for me, because GitLab.com's free tier allows 2000 CI minutes per month. I would have a very hard time using all of this with Zola.
I've only just scratched the surface using Zola, but so far I'm very happy with it.