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.

Revisions

  1. husjon revised this gist Nov 23, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    A write-up of how I'm using this can be found at https://husjon.github.io/notes/Obsidian-to-Quartz-setup
  2. husjon revised this gist Nov 23, 2022. No changes.
  3. husjon created this gist Nov 22, 2022.
    34 changes: 34 additions & 0 deletions obsidian_quartz-publish.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    #!/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"