Skip to content

fix(flame): canonical URL for the docs index and og:image under a matching deploy path - #465

Merged
gitfromwildan merged 2 commits into
mainfrom
fix/flame-seo-assets
Nov 5, 2026
Merged

gitfromwildan merged 2 commits into
mainfrom
fix/flame-seo-assets

Conversation

@gitfromwildan

@gitfromwildan gitfromwildan commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Why

An audit of the build output for meta.basePath and experimental.pages looked at the client bundle CSS and JS, assets such as the OG image and favicon, and the SEO metadata. It found two bugs in the metadata, both reproduced on Bun and Node. The bundles and assets themselves were fine.

Changes

Docs index canonical. With a prefixed meta.basePath, docs/index.mdx got the landing page's canonical and og:url (<baseURL>/) instead of its own (<baseURL><basePath>/). Search engines then treated the docs index as a duplicate of the landing page, or, with experimental.pages, of the project's own home page. buildSeoMeta() now takes the page kind, "docs" by default or "landing". Both builds pass "landing" for the landing page. At a root deployment the two URLs coincide, as before.

og:image under a matching deployment path. resolveOgImage() dropped the deployment path from any image path that started with it, to undo an author who wrote out the host segment. When the first segment of meta.basePath equals that path (basePath: "/repo" under https://acme.github.io/repo), it cut off the docs prefix instead, and every page pointed at a missing image. The deployment path is now dropped only when what remains is still a docs path, or at a root deployment. It is dropped before re-basing onto the prefix, so /repo/docs/og.png under basePath: "/handbook" also resolves to the handbook copy.

Case Before After
Docs index canonical, basePath: "/docs" https://acme.dev/ https://acme.dev/docs/
Docs index canonical, flag on, under …/repo https://acme.github.io/repo/ (the project's home) https://acme.github.io/repo/docs/
og:image, basePath: "/repo" under …/repo …/repo/assets/images/og.png (missing, 8 pages) …/repo/repo/assets/images/og.png (exists)

Patch changeset for @docubook/flame.

Verification

  • Build matrix. The template was built with basePath set to /docs, /handbook/v2, "" and /repo, with experimental.pages off and on, and with baseURL set to https://acme.dev and https://acme.github.io/repo. That is 16 builds per runtime. An auditor checked every page:

    • canonical present on indexable pages, equal to og:url, and pointing at the page itself;
    • og:image absolute and mapped to an existing file;
    • favicon, stylesheets, scripts and modulepreload resolve;
    • every url() in the built CSS resolves (data URIs excluded);
    • every search index URL maps to a page.

    Before: 16 of 16 combinations had problems on Bun and on Node. After: 16 of 16 are clean on both.

  • Browser. Each dist was served under /repo/ like a GitHub Pages project site, for /docs with the flag on, "" off, /repo on and /handbook/v2 off. In Chromium, every page had no failed requests, errors or CSP violations, the stylesheet applied, Mermaid rendered, and og:image returned 200.

  • vitest: 786 tests pass, including new cases for the docs index and landing canonicals and a 13-case og:image deployment-path matrix. tsc, oxlint, prettier and test:release-plan are clean, and the pre-push hook passed.

Review follow-up (ff1a6cf)

Pullfrog noted that the deployment-path strip ran on the synthesized ${prefix}/${image}, so a bare relative image could lose a segment. For example, docs/og.png with basePath: "/repo" under …/repo resolved to …/repo/repo/og.png. The strip now checks the authored image, so only a root-relative path the author wrote is affected. Three bare-relative cases were added to the matrix. Two of them fail on the old condition and all pass now. The 16-build audit is still clean on Bun and Node.

Not changed: extensionless canonical URLs

Canonical and og:url are written without .html (…/docs/guide/routing), while links and files use .html. On hosts without clean URLs, every non-index canonical 404s. This includes GitHub Pages, which flame deploy targets; in the browser check above, the canonical of each non-index page returned 404 from the plain static server. Changing it affects every host, so it is left for a separate decision. The options:

  • keep extensionless canonicals, which is right on Vercel, Netlify and Cloudflare;
  • always use .html, which works everywhere but points the canonical at a 308 redirect on clean-URL hosts;
  • add an option such as meta.cleanUrls (default true), with GitHub Pages builds from flame deploy using false.

…ching deploy path

- The docs index got the landing page's canonical and og:url
  (`<baseURL>/`) whenever meta.basePath has a prefix, so search engines
  treated it as a duplicate of the landing page, or, with
  experimental.pages, of the project's own home page. buildSeoMeta() now
  takes the page kind ("docs" by default, "landing" for the landing page)
  and gives the docs index `<baseURL><basePath>/`.
- og:image lost the docs prefix when its first segment equals the
  deployment path from meta.baseURL (basePath "/repo" under
  https://acme.github.io/repo), so every page pointed at a missing image.
  The deployment path is now dropped only when the author wrote it out and
  what remains is still a docs path, and before re-basing onto the prefix.

An audit of 16 basePath x experimental.pages x baseURL builds on Bun and
Node found no other broken SEO tags or assets: stylesheets, scripts,
chunks, favicons, url() in CSS and search index URLs all resolve.
@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 Preview Nov 5, 2026 1:31pm 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.

ℹ️ No critical issues. One minor og:image edge case is noted inline.

Reviewed changes

Reviewed in senior mode because this touches the flame build/render pipeline. I checked the canonical URL split and the reordered og:image deployment-path handling, and traced every buildSeoMeta() caller in build.ts and build.impl.ts.

  • Docs index canonical: the new SeoPage kind gives the docs index (slug "") the URL <baseURL><prefix>/. Only the landing call passes "landing" and keeps <baseURL>/. The two builds call it the same way, and at a root deployment the two URLs are the same, as before.
  • og:image deployment path: the host segment is now removed before re-basing, and only when what is left is still a docs path. This fixes basePath: "/repo" under …/repo, basePath: "/docs" under …/docs, and multi-segment prefixes such as /repo/v2 under …/repo.
  • Tests and changeset: there are new canonical cases, a 10-case og:image matrix, and a source-parity test across both builds (other tests in __tests__ already read node sources the same way). There is also a patch changeset for @docubook/flame.

Overall: READY WITH MINOR FIXES.

Top priorities:

  1. Run the deployment-path strip only on paths the author wrote as root-relative (see the inline comment).

There are no other findings. I found no DRY, security, or cross-runtime parity problems. isDocsPath is imported straight from ./base-path, which is fine for this server-only module.

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

Comment thread packages/flame/.docu/node/seo.ts Resolved
Only strip the deployment path from an og:image the author wrote as a
root-relative path. The check ran on the synthesized `${prefix}/${image}`,
so a bare relative image could lose a segment: `docs/og.png` with
basePath "/repo" under https://acme.github.io/repo resolved to
`…/repo/repo/og.png` instead of `…/repo/repo/docs/og.png`, and
`repo/og.png` at a root deployment under `…/repo` resolved to
`…/repo/og.png`.

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

✅ No new issues found. The prior og:image finding is addressed cleanly.

Reviewed changes

Reviewed in senior mode (flame build/render pipeline): the one follow-up commit since the last review.

  • Deployment-path strip scoped to authored paths: resolveOgImage() now tests the authored image instead of the synthesized ${prefix}/${image}. Any image that starts with ${deploymentPath}/ is root-relative, so path === image inside the branch, and bare relative images can no longer lose a segment.
  • Bare-relative matrix cases: added three cases to the matrix — docs/og.png under basePath: "/repo", repo/og.png at a root deployment, and og.png under /docs. Together they pin the regression the prior thread described.

Verdict: READY. There are no open Pullfrog threads.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@gitfromwildan
gitfromwildan merged commit cbae9b7 into main Nov 5, 2026
15 checks passed
@gitfromwildan
gitfromwildan deleted the fix/flame-seo-assets branch November 5, 2026 13:38
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