#!/bin/bash # Generates hugo/data/website.json: the current commit (short hash + date) # of THIS website/CMS-code repo itself - shown in the footer next to the # Manifest version (see baseof.html) so an installation can tell at a # glance which code state it's actually running, independent of whether # it's still identical to the template or has since been developed further # on its own. Deliberately NOT a frozen "forked from template version X" # marker - once a fork's own commits land, this reflects those, not the # template's history. # # Unlike hugo/data/methoden.json/varianten.json (generate-verlauf.rb), this # reads the website repo's own git history directly - no separate # module.mounts repo involved, Hugo's enableGitInfo/.GitInfo would actually # work here, but a plain "git log" call keeps this consistent with the # same approach already used for methoden/varianten dates. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" OUT="$ROOT/hugo/data/website.json" mkdir -p "$(dirname "$OUT")" commit="$(git -C "$ROOT" rev-parse --short HEAD)" datum="$(git -C "$ROOT" log -1 --format=%aI)" jq -n --arg commit "$commit" --arg datum "$datum" '{commit: $commit, datum: $datum}' > "$OUT" echo "website.json aktualisiert: $commit ($datum)"