Hosting a Zola site on GitHub Pages
Photo by Lars Kienle on Unsplash
Zola is a static site generator built in Rust. This site used to run on Zola. It separates content from HTML, CSS, and JS, which makes development much easier.
This post details how to host a Zola site on GitHub Pages. The approach is to create a repo with the <account>.github.io name and push the Zola build output into it.
Once that is done, add a custom GitHub Action workflow:
- Go to the Actions tab of the repo.
- Click New workflow.
- Add the following YAML file and commit.
# main.yml
name: adi blog on GitHub Pages
on:
push:
branches:
- main
jobs:
build:
name: Publish site
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3.0.0
- name: Build and deploy
uses: shalzz/zola-deploy-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Point the deploy workflow to the correct branch. The release build is saved to the gh-pages branch. Go to Settings > Pages and select gh-pages in the branch section. After you select the correct branch, the deploy action runs again.