' \
'
Downloads:' \
' Markdown ยท' \
' Signature (.asc)' \
'
' \
' {{- if $$sig -}}' \
'
' \
' View signature
' \
' {{$$sig}}' \
' ' \
' {{- end -}}' \
'
Verify locally:
' \
'
' \
'curl -O {{ $$download | absURL }}' \
'curl -O {{ $$asc | absURL }}' \
'gpg --verify {{ path.Base $$asc }} {{ path.Base $$download }}' \
' ' \
'
' \
> "$$path"; \
else \
echo "exists: $$path"; \
fi
# 4) Append the shortcode to posts (idempotent).
append-sigdl:
@set -euo pipefail; \
for sub in $(INCLUDE_DIRS); do \
root="$(CONTENT_DIR)/$$sub"; \
[[ -d "$$root" ]] || { echo "skip missing: $$root"; continue; }; \
$(call MD_FIND,$$root) | while IFS= read -r -d '' md; do \
if grep -q '{{< *sigdl' "$$md"; then \
echo "exists: $$md"; \
else \
printf "\n\n---\n\n{{< sigdl >}}\n" >> "$$md"; \
echo "appended: $$md"; \
fi; \
done; \
done
# (Optional) Sign files directly under content/ (useful for your own archive; readers should prefer the published copies)
sign-content:
@set -euo pipefail; \
if [[ "$(MODE)" == "interactive" ]]; then \
if tty >/dev/null 2>&1; then export GPG_TTY="$$(tty)"; fi; \
fi; \
if [[ "$(MODE)" == "loopback" ]] && [[ -z "$${GPG_PASSPHRASE:-}" ]]; then \
echo "ERROR: MODE=loopback but GPG_PASSPHRASE not set"; exit 1; \
fi; \
for sub in $(INCLUDE_DIRS); do \
root="$(CONTENT_DIR)/$$sub"; \
[[ -d "$$root" ]] || continue; \
$(call MD_FIND,$$root) | while IFS= read -r -d '' f; do \
asc="$$f.asc"; \
echo "sign: $$f -> $$asc"; \
if [[ "$(MODE)" == "loopback" ]]; then \
printf "%s" "$$GPG_PASSPHRASE" | gpg --yes --pinentry-mode loopback --passphrase-fd 0 \
--local-user $(KEYID) --detach-sign --armor -o "$$asc" "$$f"; \
else \
gpg --yes --local-user $(KEYID) --detach-sign --armor -o "$$asc" "$$f"; \
fi; \
done; \
done
# Cleanup helpers
clean-published:
@echo "rm -rf $(PUBLISH_DIR)"; rm -rf -- "$(PUBLISH_DIR)"
clean-signatures:
@set -euo pipefail; \
find "$(PUBLISH_DIR)" -type f -name '*.md.asc' -delete 2>/dev/null || true; \
find "$(CONTENT_DIR)" -type f -name '*.md.asc' -delete 2>/dev/null || true
# --- Cleanup: remove old {{< sig ... >}} blocks so only {{< sigdl >}} remains ---
.ONESHELL:
.PHONY: remove-old-sig disable-old-sig-shortcode
# Delete any line that contains the legacy {{< sig ... >}} shortcode (but not {{< sigdl >}})
remove-old-sig:
@set -euo pipefail
for sub in $(INCLUDE_DIRS); do
root="$(CONTENT_DIR)/$$sub"
[[ -d "$$root" ]] || { echo "skip missing: $$root"; continue; }
find "$$root" -type f -name '*.md' -print0 | while IFS= read -r -d '' f; do
if grep -Eq '\{\{<\s*sig(\s|>)' "$$f"; then
sed -E -i '/\{\{<\s*sig(\s|>)/d' "$$f"
echo "removed old sig: $$f"
fi
done
done
# Disable the old layouts/shortcodes/sig.html so it can't render accidentally
disable-old-sig-shortcode:
@set -euo pipefail
path="layouts/shortcodes/sig.html"
if [[ -f "$$path" ]]; then
mv "$$path" "$$path.bak"
echo "moved $$path -> $$path.bak (legacy shortcode disabled)"
else
echo "no legacy shortcode found at $$path"
fi