Repository navigation
docs: host the docs on Read the Docs - #476
Conversation
Read the Docs serves every version, branch and pull request preview under a subpath (/en/latest/, /en/<branch>/, /en/<pr>/). When READTHEDOCS_CANONICAL_URL is set, derive Next's basePath from it and emit trailing-slash directories, so the static export works there. Make hard-coded root paths base-path aware: next/image sources get the prefix from a small helper, internal links use next/link and the hero button uses the router. Without the variable, the build output is unchanged apart from attribute order on the converted links. Read the Docs builds with Node.js 24, as the docs image does after the move to Node.js 22 and 24 (#466). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Read the Docs, the docs live under a subpath, so browsers fetched /favicon.ico from the domain root and showed the Read the Docs icon. Declare the favicon with the base path; other builds are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set NEXT_PUBLIC_BASE_PATH from READTHEDOCS_CANONICAL_URL in every build, empty without it. Before, a NEXT_PUBLIC_BASE_PATH in the environment would prefix images and the favicon without a matching basePath. Also read the canonical URL only once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A custom head replaces Nextra's default one in every build. Keep its generic tags (Content-Language, msapplication-TileColor) and drop only Nextra's own description and social tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Note that pull request previews and branch builds are project settings on Read the Docs, and that the Node.js version follows the docs image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Reviewer's GuideThe PR moves documentation hosting from Vercel/Rahti to Read the Docs and implements build-time subpath support for versioned and pull-request previews. Next.js configuration, asset URLs, internal navigation, favicon handling, and Turbo environment declarations are updated while retaining unchanged root-path behavior outside RTD. Sequence diagram for base-path-aware documentation buildsequenceDiagram
participant RTD as Read the Docs
participant Next as Next.js build
participant Turbo as Turbo
participant Site as Static documentation output
RTD->>Next: Set READTHEDOCS_CANONICAL_URL
Next->>Next: Derive basePath and trailingSlash
Next->>Next: Set NEXT_PUBLIC_BASE_PATH
RTD->>Turbo: npx turbo run build --filter=ecc-docs...
Turbo->>Next: Build documentation app
Next->>Site: Write base-path-aware assets and links
RTD->>Site: Publish apps/documentation/out
Flow diagram for base-path-aware documentation navigationflowchart TD
Page["Documentation page"] --> Asset["withBasePath() for images and favicon"]
Page --> Link["next/link for internal links"]
Page --> Hero["router.push('/docs/introduction')"]
Asset --> Base["RTD base path or empty root path"]
Link --> Base
Hero --> Base
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Build and host the docs on Read the Docs (RTD), with pull request previews and per-branch builds, replacing the Vercel previews and the Rahti deployment.
.readthedocs.yaml: builds the docs app withnpx turbo run build --filter=ecc-docs...and publishesapps/documentation/out./en/latest/,/en/<branch>/,/en/<pr>/). WhenREADTHEDOCS_CANONICAL_URLis set,next.config.jsderivesbasePathfrom it and writes trailing-slash directories. Hard-coded root paths become base-path aware:next/imagesources and the favicon go through a smallwithBasePath()helper, internal links usenext/link, and the hero button uses the router.NEXT_PUBLIC_BASE_PATHis always set from the RTD URL (empty without it), so a stray value in the environment can't prefix assets.turbo.json: declares the two variables for thebuildtask (required by theturbo/no-undeclared-env-varslint rule; also puts them into turbo's cache key).Content-Language,msapplication-TileColor) and drops Nextra's own branding (the "Nextra: the next docs builder" description, Open Graph and Twitter tags).Commits: the subpath support, the favicon fix found while testing on RTD, and fixes from the pre-push review.
Closes #475
Notes
devstill uses Node.js 20). If build: move CI and Docker to Node.js 22 and 24 #470 settles on another version, changebuild.tools.nodejsaccordingly.scripts/templates/custom-elements-manifest.config.js) stay as they are. Follow-up once the URL is known.dev(with chore: remove leftovers, pin actions #469, build: move CI and Docker to Node.js 22 and 24 #470 and test: drop test scripts of packages without tests #478) is merged in (2026-10-27, head 20e93df); this PR is not stacked on ci: single CI gate and contribution docs #474. CI on that head: PR Evaluation (linting, tests on Node.js 22 and 24) and the RTD build pass.Verification
Tested on an RTD project for the fork
uniqueg/cloud-components(same two commits on top of v2.0.0-alpha.48, with Node.js 20): the main build, pull request previews, per-branch builds through an automation rule (only for branches created after the rule) and the favicon fix work.Locally, with Node.js 24.22.1 / npm 11.19.1:
npm ci --no-audit --no-fund: passes, lockfile unchanged.npm run lint: passes.npm run build(no RTD variable): passes; output at the root path, favicon at/favicon.ico. WithNEXT_PUBLIC_BASE_PATH=/strayand no RTD variable: no/strayanywhere in the output.npx turbo run build --filter=ecc-docs...) withREADTHEDOCS_CANONICAL_URLset tohttps://cloud-components.readthedocs.io/en/latest/andhttps://cloud-components--123.org.readthedocs.build/en/123/: passes.src/hrefoutside the base path./en/latest/_next/static/chunks/nextra-data-en-US.json, 200)./en/latest/and/en/123/: home page, styles and web font, logo and footer images, hero button, "View More Components" link, intro doc links, sidebar navigation, checkbox/collapsible/input demos, TRS tools component, path without trailing slash. Remaining page errors are pre-existing (getSelectId is not a functionon the home page, the same onmain) or come from the offline sandbox (live demo APIs).CI:
Linting checks,Semantic PR titleandDetect unresolved merge conflictspass. Two failures are unrelated and the same on the other open PRs:Test checks (20.x)fails at "Install playwright" (Playwright does not support chromium on ubuntu26.04-x64:ubuntu-latestmoved on);18.xis cancelled with it. The runner pin in chore: remove leftovers, pin actions #469 addresses this.Vercelfails on every current PR (chore: remove leftovers, pin actions #469, build: move CI and Docker to Node.js 22 and 24 #470, ci: npm trusted publishing and GitHub releases #473); Vercel is to be retired in favour of RTD (docs: host the docs on Read the Docs #475).Declined review findings
main: deliberate, to match build: move CI and Docker to Node.js 22 and 24 #470 (docs image onnode:24-alpine); the comment in.readthedocs.yamlsays so. Merge build: move CI and Docker to Node.js 22 and 24 #470 first, or switch to"22"/"20"here if build: move CI and Docker to Node.js 22 and 24 #470 changes.NEXT_PUBLIC_BASE_PATHinturbo.jsonis not a real input: theturbo/no-undeclared-env-varslint rule fails without it; the only effect is on turbo's cache key.next/linkinstead ofrouter.push: the button is a web component; nesting it in an anchor nests interactive elements.router.pushapplies the base path and keeps the current behaviour.feat/buildinstead ofdocs: the repository squash-merges with the PR title; the change only affects the docs site, sodocs:fits.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Host the documentation site on Read the Docs with reliable branch and pull-request previews and subpath-aware navigation and assets.
New Features:
Bug Fixes:
Enhancements:
Build:
Deployment: