From d7d9d2bd41163f547fe968817f63e2a4d6c0a8f4 Mon Sep 17 00:00:00 2001 From: Wesley Ray Date: Thu, 29 May 2025 17:21:58 -0400 Subject: [PATCH] Modified dockerfile to support overriding files within quartz repo by placing modified files under quartz_overrides/ with an identical folder structure. Modified Footer.tsx to include some quotes at the very bottom of each page. Added force option to rebuild script. Updated links appearing in page footer. --- .gitignore | 1 + Dockerfile | 8 ++-- quartz.layout.ts | 8 ++-- quartz_overrides/quartz/components/Footer.tsx | 41 +++++++++++++++++++ update_quartz_docker.sh | 29 +++++++++---- 5 files changed, 71 insertions(+), 16 deletions(-) create mode 100755 quartz_overrides/quartz/components/Footer.tsx diff --git a/.gitignore b/.gitignore index 8a2edbd..24c6827 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # .gitignore quartz/ +!quartz_overrides/quartz/ # Node node_modules/ diff --git a/Dockerfile b/Dockerfile index 0709d25..d673cba 100755 --- a/Dockerfile +++ b/Dockerfile @@ -22,10 +22,10 @@ RUN npm ci COPY --chown=node:node quartz.config.ts ./quartz.config.ts COPY --chown=node:node quartz.layout.ts ./quartz.layout.ts -# If you have other custom files/dirs at the root of your deployment repo that Quartz needs: -# e.g., custom assets not part of Obsidian content, or custom components to overlay -# COPY --chown=node:node assets/ ./assets/ -# COPY --chown=node:node components/ ./components/ +# Copy your custom overrides. +# This copies the contents of 'quartz_overrides/' from your deployment repo +# into /home/node/app/, overlaying any matching paths from the original framework. +COPY --chown=node:node quartz_overrides/ . # Copy the Obsidian content prepared by the host script into ./content COPY --chown=node:node content/ ./content/ diff --git a/quartz.layout.ts b/quartz.layout.ts index 970a5be..d54cade 100755 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -8,9 +8,11 @@ export const sharedPageComponents: SharedLayout = { afterBody: [], footer: Component.Footer({ links: { - GitHub: "https://github.com/jackyzha0/quartz", - "Discord Community": "https://discord.gg/cRFFHYye7t", - }, + Git: "https://git.c0smere.net/", + Blog: "https://blog.c0smere.net/", + Resume: "https://resume.c0smere.net/", + LinkedIn: "https://www.linkedin.com/in/wesley-m-ray/" + } }), } diff --git a/quartz_overrides/quartz/components/Footer.tsx b/quartz_overrides/quartz/components/Footer.tsx new file mode 100755 index 0000000..97e9fbe --- /dev/null +++ b/quartz_overrides/quartz/components/Footer.tsx @@ -0,0 +1,41 @@ +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" +import style from "./styles/footer.scss" +import { version } from "../../package.json" +import { i18n } from "../i18n" + +interface Options { + links: Record +} + +export default ((opts?: Options) => { + const Footer: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { + const year = new Date().getFullYear() + const links = opts?.links ?? [] + const quote1 = "Failure is unique among sin, in that we can turn it into a virtue when it drives us to succeed." + const quote2 = "The living diminish, but the machine endures..." + + return ( + + ) + } + + Footer.css = style + return Footer +}) satisfies QuartzComponentConstructor diff --git a/update_quartz_docker.sh b/update_quartz_docker.sh index 14123b1..7c2dea9 100755 --- a/update_quartz_docker.sh +++ b/update_quartz_docker.sh @@ -20,6 +20,12 @@ cd "$QUARTZ_PROJECT_DIR" || { log_message "FATAL: Failed to cd to project direct log_message "--- Quartz Docker Update Script Started ---" +FORCE_REBUILD=false +if [ "$1" == "force" ]; then + log_message "Force rebuild argument ('$1') received." + FORCE_REBUILD=true +fi + # --- Step 1: Ensure Quartz Framework Source is Present and Updated --- FRAMEWORK_FULL_PATH="${QUARTZ_PROJECT_DIR}/${QUARTZ_FRAMEWORK_DIR_NAME}" if [ -d "${FRAMEWORK_FULL_PATH}/.git" ]; then @@ -43,19 +49,24 @@ fi # --- Step 2: Change Detection for Obsidian Content --- NEEDS_REBUILD=false - -if [ ! -d "$OBSIDIAN_CONTENT_SOURCE" ]; then - log_message "ERROR: Obsidian content source directory does not exist: ${OBSIDIAN_CONTENT_SOURCE}" - NEEDS_REBUILD=false -elif [ ! -f "$LAST_BUILD_TIMESTAMP_FILE" ]; then - log_message "No last build timestamp found. Triggering initial rebuild." +if [ "$FORCE_REBUILD" = true ]; then + log_message "Forcing rebuild as per argument." NEEDS_REBUILD=true else - if find "$OBSIDIAN_CONTENT_SOURCE" -type f -newer "$LAST_BUILD_TIMESTAMP_FILE" -print -quit | grep -q .; then - log_message "Changes detected in Obsidian content. Triggering rebuild." + if [ ! -d "$OBSIDIAN_CONTENT_SOURCE" ]; then + log_message "ERROR: Obsidian content source directory does not exist: ${OBSIDIAN_CONTENT_SOURCE}" + # Decide if this is fatal or if you want to try building without new content + # For now, it will not set NEEDS_REBUILD=true, so script might exit if no prior timestamp + elif [ ! -f "$LAST_BUILD_TIMESTAMP_FILE" ]; then + log_message "No last build timestamp found at ${LAST_BUILD_TIMESTAMP_FILE}. Triggering initial rebuild." NEEDS_REBUILD=true else - log_message "No changes detected in Obsidian content since last build." + if find "$OBSIDIAN_CONTENT_SOURCE" -type f -newer "$LAST_BUILD_TIMESTAMP_FILE" -print -quit | grep -q .; then + log_message "Changes detected in Obsidian content. Triggering rebuild." + NEEDS_REBUILD=true + else + log_message "No changes detected in Obsidian content since last build." + fi fi fi