Alek's Blog

How to run zola generated Site on gitlab pages

Introduction🔗

After some time without an personal blog have I thought to write down what I have learned and use(d). It’s mainly a personal collection of tasks, tools and setups which I have used and still use.
In the past have I tried several things plain text, plain html, some CMS like wordpress, Django, gatsby, hugo and some other stuff.
Finally I have decided to use an external CMS for some company sites because most of the Business Peoples are not very familiar with git and text editor and the CMS offers the benefit to have a more User friendly Interface 😄.

For my personal site like the one you read here have I choosed zola because I wanted a rust based Static Site Generator. On Site Generators was listed four of them which are based on rust 🦀 and I chooses zola.

Hosted?🔗

Uff 🤯 nowadays it’s very easy to host a static site for free. A lot of the version control systems (VCS) out there have a pages offer like GitLab Pages so why gitlab and not codeberg, github or any other offer?
Because I like gitlab and had already an account there, as easy as that.

Content?🔗

So, the tool decision was made but about what should I write?
There are so many, many blogs out there 🤭 about so much different topics why another blog or website, especially that the more and more Peoples uses AI to get answer for there questions?

I have answered the question with: “It’s for my laziness” 🤓.

There are several places where I have saved my gained knowledge that I always start to search where the command X or Y is documented. I try to safe the knowledge in one place with that page and be able to reach it from almost everywhere.

Summery🔗

Let’s summarize what we have now.

  • Tool: zola
  • Hosting: GitLab Pages
  • Content: Help for me and maybe others

Let’s start writing🔗

zola🔗

The documentation of zola starts with an Overview which starts with the main commands.

zola init none-blog
cd none-blog
git remote add origin https://gitlab.com/aleks001/none-blog.git
git submodule add https://codeberg.org/salif/linkita.git themes/linkita

The last line adds the zola theme linkita which I have choose from the list of themes.

Now was I able to start with the writing and you can see the Blog Posts here and it will grow.

The config of this site is here

Create Content🔗

What I have learned from several Site analytics tool is to add always the following frontmatter for a good page.

+++
title='How to run zola generated Site on gitlab pages'
description='How to run zola generated Site on gitlab pages'
updated=2025-08-26
date=2025-08-26

[taxonomies]
categories= ["zola","gitlab"]
tags= ["zola", "gitlab", "rust"]
+++

I now just create the markdown files with the content and that’s it.

GitLab Pages🔗

To be able to use GitLab Pages is a gitlab account and a repository requierd, this is my for that page/blog https://gitlab.com/aleks001/none-blog/

There is a zola GitLab Pages documentation which shows how to bring the zola generated pages to the GitLab Pages. I have adopted the .gitlab-ci.yml a little bit with the knowledge of the gitlab doc. There is a step to create compressed files so that the content will be send compressed to the browser, which saves bandwith.

That’s my .gitlab-ci.yml

stages:
  - build
  - deploy

default:
  image: debian:stable-slim

variables:
  GIT_SUBMODULE_STRATEGY: "recursive"

  ZOLA_VERSION:
    description: "The version of Zola used to build the site."
    value: "0.21.0"
  ZOLA_RELEASE_DIR:
    value: "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}"

  ZOLA_TARBALL:
    value: "zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz"

pages-build:
  stage: build
  image: debian:stable-slim
  pages: true
  script:
    - |
      apt-get update
      DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends wget ca-certificates
      echo "******************************************************"
      echo "*"
      echo "* Using zola version: ${ZOLA_VERSION}"
      echo "* Retrieving zola tarball: ${ZOLA_TARBALL}"
      echo "* ..from: ${ZOLA_RELEASE_DIR}"
      echo "*"
      echo "******************************************************"
      wget --no-verbose ${ZOLA_RELEASE_DIR}/${ZOLA_TARBALL}
      tar -xzf ${ZOLA_TARBALL}
      ./zola build --base-url https://blog.none.at --minify
      #./zola build --base-url $CI_PAGES_URL --minify

  artifacts:
    paths:
      - public

pages-deploy:
  stage: deploy
  image: debian:stable-slim
  pages: true
  dependencies:
    - "pages-build"
  script:
    - |
      echo "Deploy pages built in previous stage"
      apt-get update
      DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends brotli zstd
      find public -type f -regex '.*\.\(htm\|html\|xml\|txt\|text\|js\|css\|svg\)$' -exec gzip -f -k {} \;
      find public -type f -regex '.*\.\(htm\|html\|xml\|txt\|text\|js\|css\|svg\)$' -exec brotli -f -k {} \;
      find public -type f -regex '.*\.\(htm\|html\|xml\|txt\|text\|js\|css\|svg\)$' -exec zstd -f -k {} \;

  artifacts:
    paths:
      - public

  rules:
    # This rule makes it so that your website is published and updated only when
    # you push to the default branch of your repository (e.g. "master" or "main").
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Custom domains🔗

Because of the possibility to use GitLab Pages with custom domains have I configured the subdomain blog for my Domain none.at to have a nicer URL as documented at GitLab Pages DNS records.

Make it public🔗

After all this steps can I now make the git triple to bring the page into the public internet.

  • git add .
  • git commit -s -m ‘Init’
  • git push

This will be repeated for all further pages just with a different commit message 😄.