Posted on :: Tags: , ,

Everything I need to not forget.

Zola

Themes

After choosing a theme:

zola init mysite
git init  
git submodule add https://github.com/username/theme_name.git themes/theme_name
git submodule update --init --recursive   #very important
git submodule update --remote --merge     #very important

Then create/import some content, copy the templates and eventually the rest. Check if it runs with

zola serve 

If using a custom domain, add a CNAME file to static/, with the domain name written inside.

Github

Repository

To serve a site at username.github.io, name the repository <username>.github.io, (otherwise GitHub will append the repository name to the URL, e.g.: username.github.io/repositoryname)

In the repository setting, activate Actions -> General -> Workflow permissions -> Read and write permissions, otherwise the Github Action trying to build the website will fail.

Once the repository has been created, stage and commit the local changes, add the remote origin and push the changes.

Github Actions

Go to Actions -> new workflow -> setup a workflow yourself, and create a .yml file:

on: push
name: Build and deploy GH Pages
jobs:
  build:
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - name: checkout
        uses: actions/checkout@v4
      - name: build_and_deploy
        uses: shalzz/zola-deploy-action@v0.19.2
        env:
          # Target branch
          PAGES_BRANCH: gh-pages
          # Provide personal access token
          TOKEN: ${{ secrets.GITHUB_TOKEN }}

Commit and push the changes, wait for the job to terminate, and as soon as the gh-pages branch has been created, go to Settings -> Pages -> Deploy from branch -> gh-pages, and also check if the custom domain has been correctly setup.