From 3d9b3d69f321055e93380d8684f40b8799edc1b1 Mon Sep 17 00:00:00 2001 From: Bhumika Garg Date: Thu, 4 Jun 2026 16:18:28 +0530 Subject: [PATCH 1/3] Fix: resolve 404 page asset loading on nested routes Signed-off-by: Bhumika Garg --- .github/workflows/build-and-preview-docs.yml | 3 ++- .github/workflows/hugo.yaml | 2 +- layouts/404.html | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-preview-docs.yml b/.github/workflows/build-and-preview-docs.yml index 3ea042c285d..1b80fad60f8 100644 --- a/.github/workflows/build-and-preview-docs.yml +++ b/.github/workflows/build-and-preview-docs.yml @@ -72,6 +72,7 @@ jobs: if: github.event.action != 'closed' env: HUGO_PREVIEW: 'true' + HUGO_PREVIEW_BASE_URL: https://docs.layer5.io/pr-preview/pr-${{ github.event.pull_request.number }}/ run: | npm run build:preview cat > public/robots.txt <<'EOF' @@ -145,7 +146,7 @@ jobs: with: header: pr-preview message: | - 🚀 Preview deployment: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/ + 🚀 Preview deployment: https://docs.layer5.io/pr-preview/pr-${{ github.event.pull_request.number }}/ > *Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment [here](https://github.com/${{ github.repository }}/actions/workflows/pages/pages-build-deployment)* - name: Comment on pruned previews diff --git a/.github/workflows/hugo.yaml b/.github/workflows/hugo.yaml index 6e207e8ff7a..666df5e7c81 100644 --- a/.github/workflows/hugo.yaml +++ b/.github/workflows/hugo.yaml @@ -57,7 +57,7 @@ jobs: hugo \ --gc \ --minify \ - --baseURL "/" + --baseURL "https://docs.layer5.io/" cp CNAME public/CNAME touch public/.nojekyll - name: Deploy to GitHub Pages diff --git a/layouts/404.html b/layouts/404.html index 410580771b7..c55554618de 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,6 +1,19 @@ + {{- $baseHref := .Site.BaseURL -}} + {{- with getenv "HUGO_PREVIEW_BASE_URL" -}} + {{- $baseHref = . -}} + {{- end }} + + {{ partial "head.html" . }} From 870d59a70b95f383ada2fbee5fc503b18159e96a Mon Sep 17 00:00:00 2001 From: Bhumika Garg Date: Thu, 4 Jun 2026 16:30:19 +0530 Subject: [PATCH 2/3] gemini suggestion Signed-off-by: Bhumika Garg --- layouts/404.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/404.html b/layouts/404.html index c55554618de..a01980aab5c 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -5,6 +5,9 @@ {{- with getenv "HUGO_PREVIEW_BASE_URL" -}} {{- $baseHref = . -}} {{- end }} + {{- if not (strings.HasSuffix $baseHref "/") -}} + {{- $baseHref = printf "%s/" $baseHref -}} + {{- end }}