From 6a2f1ba2aeb54e28721d7b8ec9ae4be38d304f11 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 30 Mar 2026 19:27:42 +0100 Subject: [PATCH] fix(tpl): resolve broken assets on GitHub Pages subdirectory deployments Add `actions/configure-pages` step to all template build workflows and pass the detected base_url to `hugo --baseURL`, so sites deployed to subdirectory paths (e.g. user.github.io/repo-name/) generate correct asset URLs. Also fix leading-slash relURL calls in slides layout that would ignore the baseURL path component. --- modules/slides/layouts/slides/single.html | 4 ++-- templates/academic-cv/.github/workflows/build.yml | 6 +++++- templates/data-science-blog/.github/workflows/build.yml | 6 +++++- templates/dev-portfolio/.github/workflows/build.yml | 6 +++++- templates/documentation/.github/workflows/build.yml | 6 +++++- templates/link-in-bio/.github/workflows/build.yml | 6 +++++- templates/markdown-slides/.github/workflows/build.yml | 6 +++++- templates/resume/.github/workflows/build.yml | 6 +++++- templates/startup-landing-page/.github/workflows/build.yml | 6 +++++- 9 files changed, 42 insertions(+), 10 deletions(-) diff --git a/modules/slides/layouts/slides/single.html b/modules/slides/layouts/slides/single.html index 134a872d..4d886f94 100644 --- a/modules/slides/layouts/slides/single.html +++ b/modules/slides/layouts/slides/single.html @@ -100,7 +100,7 @@
{{/* Back to library link */}} - + @@ -195,7 +195,7 @@

{{ $topics_label }}

{{ range $topics }} - + {{ . }} {{ end }} diff --git a/templates/academic-cv/.github/workflows/build.yml b/templates/academic-cv/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/academic-cv/.github/workflows/build.yml +++ b/templates/academic-cv/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/data-science-blog/.github/workflows/build.yml b/templates/data-science-blog/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/data-science-blog/.github/workflows/build.yml +++ b/templates/data-science-blog/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/dev-portfolio/.github/workflows/build.yml b/templates/dev-portfolio/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/dev-portfolio/.github/workflows/build.yml +++ b/templates/dev-portfolio/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/documentation/.github/workflows/build.yml b/templates/documentation/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/documentation/.github/workflows/build.yml +++ b/templates/documentation/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/link-in-bio/.github/workflows/build.yml b/templates/link-in-bio/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/link-in-bio/.github/workflows/build.yml +++ b/templates/link-in-bio/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/markdown-slides/.github/workflows/build.yml b/templates/markdown-slides/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/markdown-slides/.github/workflows/build.yml +++ b/templates/markdown-slides/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/resume/.github/workflows/build.yml b/templates/resume/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/resume/.github/workflows/build.yml +++ b/templates/resume/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: | diff --git a/templates/startup-landing-page/.github/workflows/build.yml b/templates/startup-landing-page/.github/workflows/build.yml index 0e1c5371..07d4a2a9 100644 --- a/templates/startup-landing-page/.github/workflows/build.yml +++ b/templates/startup-landing-page/.github/workflows/build.yml @@ -112,13 +112,17 @@ jobs: restore-keys: | ${{ runner.os }}-hugo-resources- + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with Hugo env: HUGO_ENVIRONMENT: production HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }} run: | echo "Hugo Cache Dir: $(hugo config | grep cachedir)" - hugo --minify + hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" - name: Generate Pagefind search index (if applicable) run: |