Skip to content

Fix #716: scope <base> tag override to docs index page#724

Open
lobennett wants to merge 1 commit intoReproNim:masterfrom
lobennett:fix/trailing-slash-index-base-tag
Open

Fix #716: scope <base> tag override to docs index page#724
lobennett wants to merge 1 commit intoReproNim:masterfrom
lobennett:fix/trailing-slash-index-base-tag

Conversation

@lobennett
Copy link
Copy Markdown

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).

Before (/neurodocker) After (with fix)
before after

Verified locally: index at both URL forms, all 26 subpages, search, dark-mode persistence, mobile viewports, and external #fragment arrival — all clean (Playwright). Subpages are unchanged (no <base> tag emitted).

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.
Copy link
Copy Markdown

@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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] missing trailing slash messes-up doc

1 participant