Reproducible development environment for Zola which relies on Nix, a purely functional and cross-platform package manager.
Start with nix-shell --pure
.
There is no built-in command for this in Zola, simply copy from one of the existing pages or create a file with only the frontmatter like:
+++
title = "My page"
(...)
+++
Start web server for development on localhost:1111
zola serve
lint
The application is hosted on Cloudflare and configured via the web UI.
Preview deployments are commenting in pull requests whenever the deploy preview is ready.
The domain dmarcoux.com
is managed on
Cloudflare with a CNAME
record for @
pointing
to the default site name provided by Cloudflare Pages.
Since Cloudflare Pages only support a single build configuration for all environments (preview and production), I need to use a few tricks in order to have the right base URL depending on the environment. Credits goes to this comment.
As for the development environment, it isn't affected since zola serve
already
overwrites the base URL to localhost
.
In the preview environment, the environment variable CF_PAGES_URL
is set to
the URL of the preview deployment, so this can be passed to the zola build
command with the --base-url
flag. In production, we set the environment
variable CF_PAGES_URL
to https://dmarcoux.com
. This way, I can use the same
build command for both environments and have the right base URL in all
environments.
- Build command:
zola build --base-url $CF_PAGES_URL
- Build output directory:
/public
- Root directory:
/
- Build comments on pull requests:
Enabled
The following environment variables are set.
Production & Preview:
ZOLA_VERSION
with the value0.19.2
Production:
CF_PAGES_URL
with the valuehttps://dmarcoux.com
- I've based my theme on Apollo.