Skip to content

Fix: resolve 404 page asset loading on nested routes#1077

Open
Bhumikagarggg wants to merge 3 commits into
layer5io:masterfrom
Bhumikagarggg:fix/404-assest
Open

Fix: resolve 404 page asset loading on nested routes#1077
Bhumikagarggg wants to merge 3 commits into
layer5io:masterfrom
Bhumikagarggg:fix/404-assest

Conversation

@Bhumikagarggg
Copy link
Copy Markdown
Contributor

@Bhumikagarggg Bhumikagarggg commented Jun 4, 2026

Notes for Reviewers

  • This PR fixes the 404 page asset resolution issue for nested missing routes in production (e.g., /foo/bar) by ensuring assets resolve correctly from the appropriate base path.
  • The fix preserves relative asset behavior for GitHub Pages PR previews under /pr-preview/pr-<number>/.
  • Important: URLs such as /pr-preview/pr-1073/j are currently served by the root GitHub Pages 404.html, not the preview folder’s 404.html. As a result, the exact preview behavior will fully work after the root 404.html is deployed with this redirect logic (post-merge production deploy).
  • Tested on nested missing routes and PR preview paths to ensure styling loads correctly.

Screenshot
Screenshot 2026-06-04 at 5 13 59 PM

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Bhumika Garg <bhumikatech2024@gmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the 404 error page template to support PR previews by dynamically setting the base URL and adding a redirection script. The review feedback highlights a potential issue where a missing trailing slash in the HUGO_PREVIEW_BASE_URL environment variable could cause relative asset URLs to resolve incorrectly, and provides a suggestion to safely append it.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread layouts/404.html Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🚀 Preview deployment: https://layer5io.github.io/docs/pr-preview/pr-1077/

Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment here

Signed-off-by: Bhumika Garg <bhumikatech2024@gmail.com>
Signed-off-by: Bhumika Garg <bhumikatech2024@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant