Skip to content

dmarcoux/dmarcoux.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development

Reproducible development environment for Zola which relies on Nix, a purely functional and cross-platform package manager.

Start with nix-shell --pure.

Create Page / Blog Post

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"
(...)
+++

Web Server

Start web server for development on localhost:1111

zola serve

Lint Markdown Files

lint

Production

Host

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.

Domain

The domain dmarcoux.com is managed on Cloudflare with a CNAME record for @ pointing to the default site name provided by Cloudflare Pages.

Settings

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 Configurations

  • Build command: zola build --base-url $CF_PAGES_URL
  • Build output directory: /public
  • Root directory: /
  • Build comments on pull requests: Enabled

Environment Variables

The following environment variables are set.

Production & Preview:

  • ZOLA_VERSION with the value 0.19.2

Production:

  • CF_PAGES_URL with the value https://dmarcoux.com

Credits

  • I've based my theme on Apollo.