Skip to content

fix(flame): use .html canonical URLs for GitHub Pages deploys - #466

Closed
gitfromwildan wants to merge 1 commit into
mainfrom
fix/flame-pages-canonical-html
Closed

gitfromwildan wants to merge 1 commit into
mainfrom
fix/flame-pages-canonical-html

Conversation

@gitfromwildan

Copy link
Copy Markdown
Member

Why

Canonical and og:url tags are extensionless (…/docs/guide/routing), while links and files use .html. GitHub Pages serves files by exact path, so on the host flame deploy targets 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.html to /page. A docu.json option 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 holds DEPLOY_TARGET_ENV (FLAME_DEPLOY_TARGET), resolveDeployTarget() and canonicalNeedsHtml(), and paths.ts exposes deployTarget(). It is deliberately separate from experimental.ts: FLAME_STANDALONE stays scoped to experimental.pages and is unchanged.
  • Only the GitHub Pages deploy sets it.
    • flame deploy without --docker sets FLAME_DEPLOY_TARGET=github-pages for its local build, on both runtimes.
    • The generated workflow sets it on the build step, on its own line next to FLAME_STANDALONE.
    • --docker and plain flame build do 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:image is unaffected.
  • Cache. The deploy target is part of the page-asset key, so a page cached by flame build is not reused by flame deploy, or the reverse.
  • Kept workflows. keptWorkflowWarnings() is shared by both deploy entries. It warns, for every project, when a kept .github/workflows/deploy.yml lacks the target, which is the case for workflows from an older Flame. It still warns about FLAME_STANDALONE for experimental.pages with a prefix.
  • Docs. deployment.mdx explains the behavior. Patch changeset for @docubook/flame.
Command Docs page canonical Docs index
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:

    • the deploy target and .html canonicals, with directory indexes and og:image unchanged;
    • the workflow env lines;
    • every combination of kept-workflow warnings.

    The source-shape checks for the cache key, the deploy parity and the landing call were updated. tsc, oxlint, prettier and test:release-plan are clean, and the pre-push hook passed.

  • End to end on Bun and Node (template, baseURL https://acme.github.io/repo). Running flame build, then flame deploy, then flame build, then flame deploy --docker gives extensionless, .html, extensionless and extensionless canonicals. Each target switch re-rendered all pages, and --docker after flame build reused 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.

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.
@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docu Ignored Ignored Nov 5, 2026 2:02pm UTC

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. Only github-pages is recognized, and the value is read at call time.
  • buildSeoMeta(…, options): htmlSuffix adds .html to docs pages that have a non-empty slug. The landing page, the docs index and og:image are unchanged.
  • Both builds: build.ts and build.impl.ts pass the flag and add the target to assetHash, so switching between flame build and flame deploy re-renders pages.
  • Deploy flows: on Bun and on Node/Deno, a local flame deploy without --docker sets 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

  1. Check the 404 claim on a real *.github.io site before merging. My check is inline.
  2. If extensionless URLs resolve, drop the change, or reframe it around a case you have actually seen fail.
  3. 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?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment on lines +10 to +12
* 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gitfromwildan
gitfromwildan deleted the fix/flame-pages-canonical-html branch November 5, 2026 14:08
gitfromwildan added a commit that referenced this pull request Nov 5, 2026
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.
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.

1 participant