Deploy a Zola site to GitHub Pages
There are a thousand different static site generators out there and I have probably tried them all by now. Over the years, I kept coming back to Hugo, because it’s solid, reliable, and has a huge community. But I was never a big fan of the Go-flavored templating language or some of the confusing conventions.
Lately I have been turning to Zola for new static site projects. Zola is a static site generator in the style of Hugo, but written in Rust 🦀. It’s simpler and faster, is also a available as a single portable binary, and uses the templating language Tera. While not as popular as Hugo, Zola is supported by many of the “just push to deploy”-platforms (eg. GitHub Pages, Netlify, Render, Cloudflare Pages, etc.) that take the hassle out of hosting static sites.
So when I recently had to put together a quick static site for the Copenhagen Rust Community, it was the obvious choice.
The deployment instructions in the Zola docs reference the traditional GitHub Pages deployment method. But last year, GitHub introduced custom Actions workflows for GitHub Pages and I wanted to try that method instead.
Since there was no premade workflow template for Zola sites, I copied the suggested workflow for Hugo and adapted it. I thought I would share it, in case someone needs it.
Instructions #
Step 1 #
Go to the Settings tab of your repository, and find Pages in the sidebar.
In the Source dropdown, choose GitHub Actions. Then click Create your own.
Step 2 #
Name the file deploy.yml
and paste in the following workflow configuration:
|
|
Make sure to update options like branches:
, path:
, and ZOLA_VERSION
to match your preferences before you save.
Step 3 #
The Actions workflow will run automatically and you can inspect the progress in the Actions tab of your repository page.
Once configured, any commits pushed to the branch will trigger a build and a deployment of the hosted GitHub Pages site.