Quartz 4

https://quartz.jzhao.xyz/setting-up-your-GitHub-repository Quartz 4 is a static site generator that generates static build of obsidian vault. I use Quartz 4 and a CI pipeline to automatically publish my site to xiaow.dev

Git repo layout

My Repo https://github.com/clive2000/obsidian-vault currently has following layout

❯ tree -L 1
.
├── quartz
├── README.md
└── vault

Specifically, the vault folder is my obsidian vault. And quartz folder is the source code tree of the quartz4 SSG. The quartz folder is checked out using git subtree:

git subtree add --prefix=quartz https://github.com/jackyzha0/quartz.git v4 --squash

To update the git subtree (sync remote quartz 4 changes) we can do:

git subtree pull --prefix=quartz https://github.com/jackyzha0/quartz.git v4 --squash

CI Script

A very simple CI script is placed under the repo root named build.sh

#!/bin/bash
 
set -e
 
  
 
cd quartz
 
npm ci
 
npx quartz build --directory=../vault

In Cloudflare Page settings, set following

SettingValue
Build commandbash build.sh
Build output directoryquartz/public
Environment variableNODE_VERSION=22

Private Posts

I used following ignorePatterns in quartz.config.ts. https://quartz.jzhao.xyz/features/private-pages

    ignorePatterns: [
      "private",
      "templates",
      ".obsidian",
      "**/templates",
      "**/private"
    ],

This will exclude any files or folders named private at any level of nesting

Plugins

see Plugins