deploy: single-slash urls for empty doc-id, trailing-slash redirects - #1580
Conversation
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
|
The CI failure here is unrelated to this change: the #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 |
With
--doc-id ""(site deployed at a domain root) internal urls were composed as/<doc-id>/<dir>/<page>, producing protocol-relative//dir/pagereferences in page bodies, chapter index redirect stubs andsearch-entries.xml— browsers resolve those as a host nameddirand leave the site. Empty doc-id now emits single-slash root-relative urls, matching the existing handling inWebResource,HtmlPageandLlmContentGenerator.Redirect stubs also gain trailing-slash targets: the stub
<dir>/index.htmland 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,ServerSideSimplifiedRendererTestandPageRedirectsTest(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