Repository navigation
fix(flame): use .html canonical URLs for GitHub Pages deploys - #466
gitfromwildan wants to merge 1 commit into
Conversation
Canonical and og:url tags were extensionless, and GitHub Pages serves
files by exact path, so every non-index canonical 404ed there. Clean URLs
are a platform setting, so docu.json gets no option. Instead the deploy
flow that targets GitHub Pages says so:
- deploy-target.ts (new, pure): FLAME_DEPLOY_TARGET, resolveDeployTarget()
and canonicalNeedsHtml(). It is kept apart from experimental.ts:
FLAME_STANDALONE stays scoped to experimental.pages.
- `flame deploy` (no --docker) sets FLAME_DEPLOY_TARGET=github-pages for
its local build and writes it into the generated workflow's build step,
next to FLAME_STANDALONE. --docker and plain `flame build` do not set it.
- buildSeoMeta() takes { htmlSuffix }, and both builds pass it from the
deploy target. Docs pages get `.html`; the docs index and the landing
page keep their directory URLs.
- The deploy target is part of the page-asset cache key, so switching
between `flame build` and `flame deploy` re-renders pages.
- keptWorkflowWarnings() (shared by both runtimes) warns when a kept
workflow lacks the target, for every project, and keeps the existing
standalone warning for experimental.pages.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Important
The PR depends on GitHub Pages returning 404 for extensionless URLs, but real GitHub Pages serves foo.html at /foo. As written, the PR fixes a 404 that does not happen on GitHub Pages. It then puts that claim into the changeset, the docs and a warning that every existing Pages user will see on every deploy. Mode: senior (deploy + build render pipeline). Verdict: NOT READY (P1, confidence 0.85).
Reviewed changes
I reviewed the single commit, which adds a FLAME_DEPLOY_TARGET=github-pages signal so that GitHub Pages builds emit .html canonical and og:url URLs.
deploy-target.ts+paths.deployTarget(): a pure env resolver. Onlygithub-pagesis recognized, and the value is read at call time.buildSeoMeta(…, options):htmlSuffixadds.htmlto docs pages that have a non-empty slug. The landing page, the docs index andog:imageare unchanged.- Both builds:
build.tsandbuild.impl.tspass the flag and add the target toassetHash, so switching betweenflame buildandflame deployre-renders pages. - Deploy flows: on Bun and on Node/Deno, a local
flame deploywithout--dockersets the env. The generated workflow also sets it on the build step. keptWorkflowWarnings(): one shared function now produces the kept-workflow warnings. It warns when the target is missing, for every project, and also covers the existing standalone warning.
Apart from the premise, the implementation looks right. Both runtimes match, the cache key includes the target, directory indexes are kept and the tests are thorough. The only finding is the premise itself (inline).
Top 3 priorities
- Check the 404 claim on a real
*.github.iosite before merging. My check is inline. - If extensionless URLs resolve, drop the change, or reframe it around a case you have actually seen fail.
- In any case, fix the changeset,
deployment.mdx, the JSDoc and the warning text. Right now they all say extensionless canonicals 404 on Pages.
ℹ️ A narrower case may still be real
GitHub Pages might handle /docs/x differently when the dist has both docs/x.html and a docs/x/ directory. That layout comes from a section x/index.mdx next to x/*.mdx. If Pages prefers the directory there (a redirect to x/, which has no index.html), then that section page's extensionless canonical really would 404. I did not verify this.
Technical details
# Possible real 404: section index next to a same-named directory
## Affected sites
- packages/flame/.docu/node/seo.ts:56 — `${baseURL}${prefix}/${slug}${suffix}` for slug `x` from `x/index.mdx`
- packages/flame/.docu/node/build.ts:516 — writes `DOCS_OUT_DIR/${file.path}.html`, so `docs/x.html` sits next to `docs/x/`
## Required outcome
- Before shipping `.html` canonicals, confirm on a real GitHub Pages site whether `/docs/x` resolves to `docs/x.html` when the directory `docs/x/` also exists.
## Open questions for the human
- If only this collision case fails, should the fix target section index pages (or every host), instead of adding a GitHub Pages deploy-target signal for all docs pages?claude-opus-5-5 | 𝕏
| * Only a host Flame deploys to with no configuration of its own needs telling | ||
| * apart: GitHub Pages serves files by exact path, so `/docs/page` 404s and | ||
| * only `/docs/page.html` works. Every other host either strips `.html` (often |
There was a problem hiding this comment.
[P1 · confidence 0.85 · correctness] GitHub Pages does not serve files only by exact path. It serves foo.html at /foo without a redirect. I checked this live against a real Pages site: curl https://typicode.github.io/husky/get-started (server: GitHub.com) returns 200, the same as get-started.html. A path that really doesn't exist returns 404. VitePress's routing guide says the same: "Netlify and GitHub Pages support this by default". So on real Pages the current extensionless canonical …/docs/guide/routing already resolves. The "GitHub Pages-like static server" in the verification did not model this.
Technical details
# The premise does not hold: Pages resolves extensionless `.html` paths
## Affected sites
- packages/flame/.docu/node/deploy-target.ts:10-14 — JSDoc says `/docs/page` 404s on GitHub Pages
- packages/flame/.docu/node/deploy.shared.ts:453-457 — new warning says canonicals "404 on GitHub Pages". It fires on every `flame deploy` for every user with a workflow generated by an older Flame, which is all current Pages users
- .changeset/pages-canonical-html.md:5-7 — "every one of them 404ed there"
- packages/flame/docs/getting-started/deployment.mdx:208 — "the extensionless URL that would 404 there"
- packages/flame/.docu/node/build.ts:295, build.impl.ts:294 — existing Pages sites get every docs canonical changed (search engine re-canonicalization) for no resolution gain
## Required outcome
- Reproduce the 404 on a real `*.github.io` deployment before shipping. Otherwise, drop the deploy-target signal, the cache-key dimension and the kept-workflow warning.
- If a real failing case exists (see the review body: a section `x.html` next to an `x/` directory), scope the fix and its wording to that case.
- In any case, no shipped text should say extensionless canonicals 404 on GitHub Pages.
## Evidence
- `curl -s -o /dev/null -w '%{http_code}' https://typicode.github.io/husky/get-started` → 200 (server: GitHub.com)
- `…/get-started.html` → 200; `…/does-not-exist` → 404
- https://vitepress.dev/guide/routing — "Netlify and GitHub Pages support this by default"There was a problem hiding this comment.
Confirmed, thanks: the premise was wrong. Against a real Pages site (server: GitHub.com), https://typicode.github.io/husky/get-started and get-started.html both return 200, and a missing path returns 404. The premise came from deployment.mdx, which says Pages serves files by exact path only. The verification modeled Pages with a plain static server that has no clean URLs, so it confirmed the wrong assumption.
The PR is closed without merging, and the branch is deleted, so no canonical changes, cache-key dimension or kept-workflow warning ship. The x.html next to an x/ directory case you mention is not verified; it would need a real Pages deployment to check.
The deployment guide said GitHub Pages serves files by exact path only and that `/docs/page` returns 404, and listed it under Limited Support with "Clean URLs: No" and an Apache server. That is wrong. Checked against a live Pages site (`server: GitHub.com`): - `/page` returns 200 and serves `page.html`, and `/page.html` returns 200, with no redirect between the two - `/page/` returns 404 - `/dir` redirects with a 301 to `/dir/` GitHub Pages moves to Zero Configuration, and its table row becomes "Automatic" / "GitHub infra". The paragraph about the address bar now says that Flame's links carry `.html` and that both forms work. The project-site and workflow paragraphs are unchanged. This claim was the premise of #466, which was closed unmerged.

Why
Canonical and
og:urltags are extensionless (…/docs/guide/routing), while links and files use.html. GitHub Pages serves files by exact path, so on the hostflame deploytargets every non-index canonical 404s. This was noted as "Not changed" in #465.Clean URLs are a platform setting, and some hosts 308-redirect
/page.htmlto/page. Adocu.jsonoption would duplicate the platform's setting and could disagree with it. Extensionless stays the default. Only the deploy that Flame itself sets up for a host without clean URLs needs telling apart, and it already knows its target.Changes
deploy-target.ts(new, pure). It holdsDEPLOY_TARGET_ENV(FLAME_DEPLOY_TARGET),resolveDeployTarget()andcanonicalNeedsHtml(), andpaths.tsexposesdeployTarget(). It is deliberately separate fromexperimental.ts:FLAME_STANDALONEstays scoped toexperimental.pagesand is unchanged.flame deploywithout--dockersetsFLAME_DEPLOY_TARGET=github-pagesfor its local build, on both runtimes.FLAME_STANDALONE.--dockerand plainflame builddo not set it.buildSeoMeta(…, { htmlSuffix }). Both builds pass it from the deploy target. Docs pages get.html, while the docs index (…/docs/) and the landing page (…/) keep their directory URLs.og:imageis unaffected.flame buildis not reused byflame deploy, or the reverse.keptWorkflowWarnings()is shared by both deploy entries. It warns, for every project, when a kept.github/workflows/deploy.ymllacks the target, which is the case for workflows from an older Flame. It still warns aboutFLAME_STANDALONEforexperimental.pageswith a prefix.deployment.mdxexplains the behavior. Patch changeset for@docubook/flame.flame build…/docs/guide/routing…/docs/flame deploy(GitHub Pages)…/docs/guide/routing.html…/docs/flame deploy --docker…/docs/guide/routing…/docs/Verification
vitest: 798 tests pass, including 17 new ones:.htmlcanonicals, with directory indexes andog:imageunchanged;The source-shape checks for the cache key, the deploy parity and the landing call were updated.
tsc,oxlint,prettierandtest:release-planare clean, and the pre-push hook passed.End to end on Bun and Node (template,
baseURLhttps://acme.github.io/repo). Runningflame build, thenflame deploy, thenflame build, thenflame deploy --dockergives extensionless,.html, extensionless and extensionless canonicals. Each target switch re-rendered all pages, and--dockerafterflame buildreused the cache, since the target is the same. The generated workflow has both env lines, and a kept old workflow triggers the warning.GitHub Pages-like static server (no clean URLs, dist under
/repo/): all 7 canonical URLs of a Pages build answer 200. Before this change every non-index canonical returned 404.