quartz guide
This is a quick guide to remind myself how I’m managing quartz.
Abstract
- docs: https://quartz.jzhao.xyz/
- config file:
quartz.config.ts - set note
publishproperty totrueto publish note - sync obsidian vault directories to quartz content folder with
rsync - use quartz.sh helper script to sync and publish
Sync to github
npx quartz syncBuild and publish quartz locally
npx quartz build --serveQuartz helper script
- helper script to:
- sync obisdian vault to quarts
- mass publish/unpublish notes by tag using Obsidian CLI
#!/bin/zsh
# Error handling
set -euo pipefail
# Help menu function
help()
{
echo "Sync Obsidian vault to Quartz and mass publish/unpublish by tag.";
echo;
echo "Syntax: quartz-sync.sh [-h|p|s|g]";
echo;
echo "Options:";
echo "-h Print help";
echo "-p Publish or unpublish notes by tag";
echo "-s Sync Obsidian vault";
echo "-g Push changes to Github";
};
# Cases for command options
while getopts "hpsg" opt; do
case "$opt" in
h) # Run help function
help; exit 0;;
p) # Publish/unpublish notes by tag
printf "Enter a tag: ";
read tag;
printf "Publish or unpublish (true/false)? ";
read bool;
array=("${(@f)$(obsidian tag name=$tag)}");
for file in "${array[@]}"; do
echo "$file";
obsidian property:set name=publish value="$bool" type=checkbox path=${file};
echo;
done;
exit 0;;
s) # Sync Obsidian vault
# Sync folders
rsync -av --delete --quiet ~/Documents/obsidian_vault/notes/ ~/Developer/Code/quartz/content/notes/;
rsync -av --delete --quiet ~/Documents/obsidian_vault/attachments/ ~/Developer/Code/quartz/content/attachments/;
rsync -av --delete --quiet ~/Documents/obsidian_vault/index.md ~/Developer/Code/quartz/content/index.md;
echo -e "✅ $(tput setaf 2)Synced notes, attachments, and index.md $(tput sgr0)"; exit 0;;
g)
cd /Users/adam/Developer/Code/quartz && npx quartz sync; exit 0;;
*) # For all invalid options, run help and exit with error
help >&2; exit 1;;
esac
done