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.
This commit is contained in:
George Cushen committed 2026-03-30 19:27:42 +01:00
1 parent 26e1f775a2
commit 6a2f1ba2ae
9 files changed
+42 -10

No files matched your search

+2 -2
View File
@@ -100,7 +100,7 @@
<div class="container mx-auto px-4 sm:px-6 max-w-5xl py-12" x-data="{ copied: false, showCitation: false, copyText: {{ $copy_link_label | jsonify }}, citationCopied: false, citationCopyText: {{ $copy_citation_label | jsonify }}, citationValue: {{ $citation_copy | jsonify }} }">
{{/* Back to library link */}}
<a href="{{ "/slides/" | relURL }}" class="inline-flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400 hover:text-primary-600 dark:hover:text-primary-400 mb-6 transition-colors">
<a href="{{ "slides/" | relURL }}" class="inline-flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400 hover:text-primary-600 dark:hover:text-primary-400 mb-6 transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/>
</svg>
@@ -195,7 +195,7 @@
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-2">{{ $topics_label }}</h2>
<div class="flex flex-wrap gap-2">
{{ range $topics }}
<a href="{{ "/slides/" | relURL }}" class="px-3 py-1 rounded-full text-sm font-medium bg-zinc-100 dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 hover:bg-primary-100 dark:hover:bg-primary-900/40 hover:text-primary-700 dark:hover:text-primary-300 transition-colors">
<a href="{{ "slides/" | relURL }}" class="px-3 py-1 rounded-full text-sm font-medium bg-zinc-100 dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 hover:bg-primary-100 dark:hover:bg-primary-900/40 hover:text-primary-700 dark:hover:text-primary-300 transition-colors">
{{ . }}
</a>
{{ end }}
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |
+5 -1
View File
@@ -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: |