Repository navigation
fix: support GitHub Pages docs.rtf subpath routing - #2
Conversation
Reviewer's GuideAPIAdd a shared base-path helper that detects the GitHub Pages
Uses of the APIUse the shared helper in the frontend so navigation, rendered links, dynamically filtered course links, and AI Studio’s return links stay under
ConfigurationPublish the browser helper and run its behavioral tests as part of the site build.
DocumentationDocument the GitHub Pages base path, the root-based Cloudflare Preview behavior, and the staging deployment details.
TestsCover host and path detection, client navigation, link rewriting, and root deployments to guard the subpath-routing behavior.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
Deploying ocodejs-docs-rtf-staging with
|
| Latest commit: |
d42b594
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f2cace8f.ocodejs-docs-rtf-staging.pages.dev |
| Branch Preview URL: | https://fix-github-pages-subpath-rou.ocodejs-docs-rtf-staging.pages.dev |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="index.html" line_range="101" />
<code_context>
+app.innerHTML=out;wire();applyBaseLinks(document)}
</code_context>
<issue_to_address>
**Filtered course links leave Pages path**
When a visitor filters courses under `/docs.rtf` and opens or copies a generated course link using a browser-native link action, `filter()` replaces `#coursegrid` with `courseCard()` links whose root-relative `href` values are not passed through `applyBaseLinks()`. Native navigation therefore leaves `/docs.rtf` and does not reach the course page.
Apply the base path to newly generated course links, or generate them with base-prefixed `href` values.
</issue_to_address>
### Comment 2
<location path="studio.html" line_range="36" />
<code_context>
+if(BASE_PATH)document.querySelectorAll('a[href^="/"]').forEach(a=>{const href=a.getAttribute("href");if(href!==BASE_PATH&&!href.startsWith(BASE_PATH+"/"))a.setAttribute("href",BASE_PATH+href)});
</code_context>
<issue_to_address>
**Studio links force the subpath**
When a user opens the root-deployed `/studio.html` on `ocodejs.co`, outside `/docs.rtf`, `studio.html` sets `BASE_PATH` to `/docs.rtf` for every path on `ocodejs.co`, unlike `index.html`, which requires the current path to start with `/docs.rtf`; its rewritten links leave the root deployment and lead to the wrong route.
Use the same pathname-qualified base-path predicate in `studio.html` as in `index.html`.
</issue_to_address>
### Comment 3
<location path="scripts/build-site.mjs" line_range="25" />
<code_context>
if (!/border-radius\s*:\s*0/i.test(source)) {
throw new Error(`${file} must preserve square-corner controls`);
}
+ if (file === "index.html" && (!source.includes("const BASE_PATH=") || !source.includes("function applyBaseLinks("))) {
+ throw new Error("index.html must support the GitHub Pages /docs.rtf subpath");
+ }
</code_context>
<issue_to_address>
**Build guard misses routing regressions**
When the routing code is reformatted without changing behavior, or a future edit breaks its behavior while leaving the checked strings in place, the source-string checks in `scripts/build-site.mjs` reject valid formatting changes but still pass when routing behavior is broken, so a routing regression can ship unnoticed.
Replace the exact source-string checks with tests that verify the base-path routing behavior.
Also at `scripts/build-site.mjs:28-29`.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: index.html:101, studio.html:36, scripts/build-site.mjs:25
Summary
https://ocodejs.co/docs.rtf/./and avoid forcing the docs prefix on root-hosted/studio.html.npm run build.Validation
f2cace8f-08e7-4497-858b-cc353ff84990, all deployment stages successful.Safety
mainremain disabled.