Fix #716: scope <base> tag override to docs index page#724
Open
lobennett wants to merge 1 commit intoReproNim:masterfrom
Open
Fix #716: scope <base> tag override to docs index page#724lobennett wants to merge 1 commit intoReproNim:masterfrom
lobennett wants to merge 1 commit intoReproNim:masterfrom
Conversation
When the docs are accessed at /neurodocker (no trailing slash), the browser resolves relative asset URLs against the root domain, causing CSS and JS to 404 and the index page to render unstyled. Sub-paths (/neurodocker/x.html or /neurodocker/dir) are unaffected because they already include a path component, so the issue is isolated to the docs root URL. Apply <base href="/neurodocker/"> only on the index page so relative URLs resolve under /neurodocker/ regardless of trailing slash. Subpages keep the default Sphinx '../_static/...' relative paths, which work correctly. Closes ReproNim#716.
There was a problem hiding this comment.
Code Review
This pull request introduces a custom Jinja2 template in docs/_templates/layout.html that extends the base layout to define a base URL specifically for the index page. This ensures that relative links on the documentation landing page resolve correctly under the /neurodocker/ path. I have no feedback to provide as there were no review comments to evaluate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #716.
When the docs are loaded at
repronim.org/neurodocker(no trailing slash, e.g. from Google), relative_static/...URLs resolve against the domain root and 404, rendering the page unstyled. A Netlify redirect can't fix it (trailing-slash normalization makes/neurodocker → /neurodocker/loop), and a universal HTML<base>breaks subpages (their../_static/...URLs resolve UP past the base).This restricts
<base href="/neurodocker/">to the index page only — the only URL where the bug manifests, and the only page whose asset URLs don't contain..(so the base can't break them)./neurodocker)Verified locally: index at both URL forms, all 26 subpages, search, dark-mode persistence, mobile viewports, and external
#fragmentarrival — all clean (Playwright). Subpages are unchanged (no<base>tag emitted).