Building Blog

2022-10-22

This blog uses Github Pages as host and Zola as the static site generator.

Since I want the repositories related to this blog to be private I ended up making 2. One for the Zola source files and another for the build files, the ones to be uploaded to Github Pages.

The Github Page repository is added as a git submodule of the Zola repository. To build in one command there is the following Makefile.

build:
    zola build
    find <github-user>.github.io ! -name .git ! -name CNAME -delete
    cp -R public/* <github-user>.github.io

This works as follows:

  1. We generate the blog files on the public directory.
  2. We delete all the files on the blog repository except for the .git directory and the CNAME file.
  3. Copy the files on the public directory to the blog repositry

After that we go into the <github-user>.github.io folder, commit and push the changes to the submodule.