Skip to content

Instantly share code, notes, and snippets.

@husjon
Last active March 14, 2024 01:52
Show Gist options
  • Save husjon/a25d9f62645122eef7bf4eeaed1ba62c to your computer and use it in GitHub Desktop.
Save husjon/a25d9f62645122eef7bf4eeaed1ba62c to your computer and use it in GitHub Desktop.
Script for publishing notes from Obsidian to Quartz
#!/bin/bash
PATH=~/go/bin:$PATH
BASE_DIR="$(realpath "$(dirname "$0")")"
OBSIDIAN_NOTES="${BASE_DIR}/.."
QUARTZ_FOLDER="${OBSIDIAN_NOTES}/../quartz"
QUARTZ_CONTENT="${QUARTZ_FOLDER}/content"
GIT_REF=34bb5aa
type hugo-obsidian || \
go install github.com/jackyzha0/hugo-obsidian@"${GIT_REF}"
cd "${QUARTZ_FOLDER}"
rm -rf public resources linkmap > /dev/null
rm assets/indices/*
hugo-obsidian \
-input="./content" \
-output="./assets/indices" \
-index \
-root="."
cd "${QUARTZ_CONTENT}"
if git diff --exit-code; then
notify-send "Quartz" "No changes"
exit
fi
git add ./ && \
git commit -m "Updated: $(date +%Y.%m.%d-%H%M)" && \
git push && \
notify-send "Quartz" "Pushed changes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment