From d71a5c3bed11c07f4fef5730c346c99de1ed29f1 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Mon, 25 May 2026 00:37:30 +0200 Subject: [PATCH] fix(docs): fix sponsor link baseURL and add git commit hash to footer - Use relURL (no leading slash) for the sponsor link so it respects the /Bose-SoundTouch/ base path on GitHub Pages; absURL and relURL both ignore the base path when the input starts with / - Inject HUGO_PARAMS_GITHASH (github.sha) via the docs workflow and forward it into the Hugo container via docker-compose.docs.yml + make dev-docs, so the deployed footer shows a clickable short hash linking to the exact commit - Use site.Params.githash (global) instead of .Site.Params.githash because Hextra calls custom/footer.html with a dict context, not a page; .Site is nil in that scope - Use substr not slice to trim the hash to 7 chars Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/docs.yml | 1 + Makefile | 2 +- docker-compose.docs.yml | 2 ++ docs/layouts/_partials/custom/footer.html | 5 ++++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2fbe190..eb5f639 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -33,6 +33,7 @@ jobs: run: hugo --source docs/ --minify --destination ../_site --baseURL "${{ steps.pages.outputs.base_url }}" env: HUGO_ENVIRONMENT: production + HUGO_PARAMS_GITHASH: ${{ github.sha }} - name: Upload artifact uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: diff --git a/Makefile b/Makefile index d0bce7f..3cba997 100644 --- a/Makefile +++ b/Makefile @@ -458,7 +458,7 @@ screenshots: # First run: make dev-docs-tidy (downloads Hextra, writes docs/go.sum) # Then: make dev-docs (http://localhost:1313, live reload) dev-docs: - docker compose -f docker-compose.docs.yml up + HUGO_PARAMS_GITHASH=$(shell git rev-parse HEAD) docker compose -f docker-compose.docs.yml up dev-docs-tidy: docker compose -f docker-compose.docs.yml run --rm hugo mod tidy --source docs/ diff --git a/docker-compose.docs.yml b/docker-compose.docs.yml index 76949f5..bff3421 100644 --- a/docker-compose.docs.yml +++ b/docker-compose.docs.yml @@ -27,6 +27,8 @@ services: # downloads Hextra once. - hugo-mod-cache:/root/.cache/hugo_cache working_dir: /src + environment: + - HUGO_PARAMS_GITHASH volumes: hugo-mod-cache: diff --git a/docs/layouts/_partials/custom/footer.html b/docs/layouts/_partials/custom/footer.html index f87a18d..4fe0e46 100644 --- a/docs/layouts/_partials/custom/footer.html +++ b/docs/layouts/_partials/custom/footer.html @@ -1,6 +1,6 @@
@@ -10,5 +10,8 @@ © 2026 Tobias Gesellchen + {{- with site.Params.githash }} + · {{ substr . 0 7 }} + {{- end }}