About the birth of this blog
Hi,
I'm Sanyi [ʃaːɲi], a 45 year old, slightly authistic developer / devops engineer / architect at Mito Group.
I experiment frequently with various technologies and I thought I should publish the results of my experiments publicly sometimes.
This blog entry is about the first step: how I found an efficient platform for this.
I did not want a hosted solution like medium.com but something more interesting I can tinker with. I think WordPress is slightly out of date so my attention turned to static site generators.
Scanning the list I bumped into Zola incidentally written in Rust, one of my favourite programming languages. I gave it a try and I liked it.
Looking through the list of themes the adidoks theme seemed perfect for me, it's especially designed for documentation pages.
Zola has multi-language support, so I will publish some of my post both in hungarian and english.
The highest priority for hosting was low cost, so I selected Cloudflare Pages, which is completely free for my purposes (I can upload up to 20000 files, max. 25 MB each).
Cloudflare Pages can start a Zola build from GitHub, so I just have to git push the source code of my blog and it automatically publishes the site in a few minutes.
Installing Zola is quite simple, you just have to download the actual binary from the
Zola releases page and put it in a folder on
the PATH. I use Ubuntu, so I simple put it into /usr/local/bin
. Do not forget to make
it executable (chmod +x /usr/local/bin/zola
)!
Creating a new site:
$ zola init project-name
Welcome to Zola!
Please answer a few questions to get started quickly.
Any choices made can be changed by modifying the `config.toml` file later.
> What is the URL of your site? (https://example.com):
> Do you want to enable Sass compilation? [Y/n]:
> Do you want to enable syntax highlighting? [y/N]:
> Do you want to build a search index of the content? [y/N]:
Done! Your site was created in /home/sapati/Desktop/project-name
Get started by moving into the directory and using the built-in server: `zola serve`
Visit https://www.getzola.org for the full documentation.
After answering the questions Zola creates the project-name
folder with
a very simple structure:
.
├── config.toml
├── content
├── sass
├── static
├── templates
└── themes
The config.toml
contains the project configuration, content goes into the content
folder
formatted as Markdown, the sass
folder is for CSS source code,
finally the static
folder contains everyting else that goes onto the published site unaltered.
The templates
folder is for Tera templates to customize the look
of the site.
The next step was to download the theme, I simply cloned the repository:
$ cd themes
$ git clone https://github.com/aaranxu/adidoks.git adidoks
$ cd ..
I had to modify config.toml
to make Zola use the theme:
taxonomies = [
{name = "authors"},
]
theme = "adidoks"
After starting the zola serve
command we can preview
our little site at the address diplayed. It will listen on
http://127.0.0.1:1111 by default.
A full static build can be made with the zola build
command,
it dumps the site into the public
folder. This shouldn't be
required for a Cloudflare deployment but the build system does
not the support the current (0.17.1) version yet, so we have
to cheat a little bit.
Deployment is not complicated either: I just registered on pages.cloudflare.com and selected the "Connect to git" option on project creation.
You have to connect your GitHub account with Cloudflare, then select the repository containing the site.
In theory you could select the Zola build configuration and set this environment variable:
ZOLA_VERSION=0.14.0
but this will not work with newer Zola versions. So as a
workaround I did run zola build
on my local machine and
pushed the public
folder into GitHub as well.
In the Cloudflare configuration I chose build configuration: None,
build command: echo
and the output directory remained public
.
That way the Cloudflare build simply copied the public
folder
from my repo.
The free package of Cloudflare contains 500 builds per month, that should be more than enough for my purposes.