Skip to content

deploy: single-slash urls for empty doc-id, trailing-slash redirects - #1580

Merged
MykolaGolubyev merged 3 commits into
testingisdocumenting:masterfrom
Bronek:bronek/fix_empty_doc-id
Aug 23, 2026
Merged

deploy: single-slash urls for empty doc-id, trailing-slash redirects#1580
MykolaGolubyev merged 3 commits into
testingisdocumenting:masterfrom
Bronek:bronek/fix_empty_doc-id

Conversation

@Bronek

@Bronek Bronek commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

With --doc-id "" (site deployed at a domain root) internal urls were composed as /<doc-id>/<dir>/<page>, producing protocol-relative //dir/page references in page bodies, chapter index redirect stubs and search-entries.xml — browsers resolve those as a host named dir and leave the site. Empty doc-id now emits single-slash root-relative urls, matching the existing handling in WebResource, HtmlPage and LlmContentGenerator.

Redirect stubs also gain trailing-slash targets: the stub <dir>/index.html and the real page directory <dir>/index/ collide at the extension-less url on hosts that resolve the file before the directory (e.g. GitHub Pages), so once the doubled slash is repaired the stub would redirect to itself in an infinite meta-refresh loop. The stub html is now built in one place shared by the chapter index and renamed-page redirects, which also repairs the doubled slash for top-level redirect targets and points redirects to the index page at the doc root.

Covered by new tests in WebSiteDocStructureTest, ServerSideSimplifiedRendererTest and PageRedirectsTest (including a deploy-to-temp-dir stub test). Verified end-to-end by deploying a doc with --doc-id "" and with a regular doc-id: the only change for non-empty doc-ids is the trailing slash in redirect targets.

Fixes #1575

Assisted-by: Claude:claude-fable-5

With --doc-id "" internal urls were composed as /<doc-id>/<dir>/<page>,
producing protocol-relative //dir/page references in page bodies, chapter
index redirect stubs and search-entries.xml - browsers resolve those as a
host named "dir". Empty doc-id now emits single-slash root-relative urls.

Redirect stubs also gain trailing-slash targets: the stub <dir>/index.html
and the real page directory <dir>/index/ collide at the extension-less url
on hosts that resolve the file first (e.g. GitHub Pages), causing an
infinite meta-refresh loop once the doubled slash is gone. The stub html
is now built in one place shared by chapter index and renamed-page
redirects, which also repairs the doubled slash for top-level redirect
targets and points redirects to the index page at the doc root.

Fixes testingisdocumenting#1575

Assisted-by: Claude:claude-fable-5
@Bronek

Bronek commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

The CI failure here is unrelated to this change: the capture screenshot (imageCapture.groovy) webtau example in znai-testing-examples opens the live duckduckgo.com homepage, which has been redesigned — the search box is now a <textarea> inside their new AI searchbox, so the example's input[...] selector matches nothing and the build fails before any of this PR's code is exercised. The same failure, byte-identical, shows on the unrelated dependabot PR (run 32409696181's sibling 32409696265); master last ran ci-build at the 1.91 release, which is why it still shows green.

#1582 repairs the example with a one-line selector update, verified locally against live duckduckgo (full search-and-capture flow, results-page selectors unchanged). Merging that first and re-running the checks here should turn this PR green.

Assisted-by: Claude:claude-fable-5

@MykolaGolubyev
MykolaGolubyev merged commit 2565f13 into testingisdocumenting:master Aug 23, 2026
1 check passed
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.

Empty doc-id emits protocol-relative internal URLs (//chapter/page) in page links, redirect stubs and search-entries.xml

2 participants