Zola on GitHub Pages
This article is about hosting this zola blog on GitHub, using GitHub pages and GitHub actions.
Zola
Step 1 : Installing Zola
Following the official doc, install Zola as follows
yay -S zola
Then initializing a new project
zola init [project_name]Step 2 : Theme
I decided to go with Terminus a port of Hugo Terminal theme I believe.
As the documentation suggests, install it as a git sub module
git submodule add https://github.com/ebkalderon/terminus.git themes/terminus
Note that if you clone a repo which uses a theme installed a git submodule, you will have to initialize it before being able to use it.
git submodule update --init --recursive
And to update the theme
git submodule update --remote themes/terminusStep 3 : Configuration
The configuration is pretty straight forward and very little is needed to get started. Everything happens in the config.toml file... For me.
If you follow the official doc it appears that the configuration should be stored in the zola.toml file, zola using config.toml only as a fallback / backward compatibility option.
In my case, using the zola.toml file did not work, maybe my configuration was missing something, I will dig into it later... maybe. Anyway this is the bare minimum
base_url = "https://theurlofyourdreams.com"
title = "self explanatory"
theme = "terminus"
compile_sass = true
build_search_index = false
[markdown]
[markdown.highlighting]
theme = "catppuccin-mocha"
[extra]Step 4 : Start
Fill up your content folder and start your local server with
zola serve
You should be good to go !
GitHub
Now that we have a local blog that works, let s host it on GitHub pages. It is easy and free :]
Step 1 : Setting up the repo
Flemme
Step 2 : Configuring GitHub Pages
In your repo, go to the "settings" tab, then "pages" on the left column.
As the source choose "GitHub Actions"
Set up your domaine name. You have set up the DNS on the registrar side, create a CNAME that points toward "[yourusername].github.io"
Enforce HTTPS after a succesful DNS check and you are good for this part.
Step 3 : GitHub Actions
The GitHub action is a yaml file that can have any name and is stored in the workflow directory inside the .github folder. Example ".github/workflows/custon_action.yml"
Last but not leat, set up the correct GitHub Actions to have your site published on github. The zola official doc provides us an example.
A few changes are needed though :
- You will probably have to change the branch to fit your own. In my case I switched from master to main
- As we are using a theme as a submodule, we have to had "with: submodules: true" at the end of the "build: steps: checkout" job.
- Finally always change the "zola_version: " to fit the on you are using on local (zola --version) Example can be found here
Using Zola official doc we will use the Pages Artifacts method.
Now you should be good to go !