diff options
| -rw-r--r-- | blog/index.qmd | 4 | ||||
| -rwxr-xr-x | homepage-render-dev.sh | 54 |
2 files changed, 56 insertions, 2 deletions
diff --git a/blog/index.qmd b/blog/index.qmd index 69b65b5..bf6191c 100644 --- a/blog/index.qmd +++ b/blog/index.qmd @@ -5,10 +5,10 @@ title: "Jayrup Nakawala | Blog" RANDOM THOUGHTS, EXPERIMENTS, AND SYSTEMS NOTES -------------------------------------------------- -- How this site works — 2026-08-05 - curl [jayrup.me/blog/how-this-site-works](https://jayrup.me/blog/how-this-site-works) - What the Jacobian Lens Measures — 2026-08-07 curl [jayrup.me/blog/jacobian-lens-frequency](https://jayrup.me/blog/jacobian-lens-frequency) +- How this site works — 2026-08-05 + curl [jayrup.me/blog/how-this-site-works](https://jayrup.me/blog/how-this-site-works) -------------------------------------------------- diff --git a/homepage-render-dev.sh b/homepage-render-dev.sh new file mode 100755 index 0000000..d8c647b --- /dev/null +++ b/homepage-render-dev.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# homepage-render-dev.sh — render jayrup.me locally WITHOUT deploying. +# +# Runs the same two-pass render (html + txt) as deploy-docker.sh inside the +# pinned quarto container, writing output to public/ (gitignored). Use this to +# preview blog posts / style changes before committing. +# +# Usage: +# ./homepage-render-dev.sh [repo-dir] # default: current directory +# QUARTO_IMAGE=<image> ./homepage-render-dev.sh # override the container image +# +# Notes: +# - The default image digest MUST stay in sync with deploy-docker.sh +# (update both deliberately when bumping quarto). +# - On voidlaptop, docker needs the docker group: run via `sg docker` or +# `DOCKER=(sg docker -c)` wrapper. On other machines plain docker works. +# - public/ and .quarto/ are gitignored; nothing here touches origin. +set -euo pipefail + +REPO="${1:-$(pwd)}" +cd "$REPO" + +QUARTO_IMAGE="${QUARTO_IMAGE:-devxygmbh/alpine-quarto@sha256:0c0d785139b467ab75c053bc24463d2450cbf928ca8ece8d9a20dedba9568fa9}" + +# Inner render script — written to a temp dir and mounted read-only into the +# container. Mirrors the logic in deploy-docker.sh; keep the two in sync. +TMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TMP_DIR"' EXIT +RENDER_SCRIPT="$TMP_DIR/homepage-render.sh" +cat > "$RENDER_SCRIPT" <<'EOF' +#!/usr/bin/env bash +set -euo pipefail +cd /site +rm -rf public +quarto render --to html +find . -name "*.qmd" -not -path "./.*" -not -path "./public/*" | while read -r file; do + rel_dir=$(dirname "${file#./}") + base_name=$(basename "$file" .qmd) + quarto render "$file" --to plain --output "${base_name}.txt" --output-dir "public/$rel_dir" +done +EOF +chmod +x "$RENDER_SCRIPT" + +echo ">> rendering with $QUARTO_IMAGE (dev, no deploy)" +docker run --rm \ + --entrypoint /bin/bash \ + -u "$(id -u):$(id -g)" \ + -e HOME=/tmp \ + -v "$REPO":/site \ + -v "$RENDER_SCRIPT":/render.sh:ro \ + -w /site \ + "$QUARTO_IMAGE" /render.sh + +echo ">> done — public/ is ready to preview: python3 -m http.server 8099 --directory public" |
