Skip to content

fix: let an authored canonical replace the page's own - #307

Merged
MohamedH1998 merged 2 commits into
mainfrom
fix/authored-canonical
Oct 28, 2026
Merged

MohamedH1998 merged 2 commits into
mainfrom
fix/authored-canonical

Conversation

@MohamedH1998

@MohamedH1998 MohamedH1998 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • A <link rel="canonical"> authored in a page's or the site's head is now the page's only canonical. Nimbus no longer emits its own beside it.
  • og:url and the structured data's url follow the authored canonical.
  • A site path in the authored link is resolved against site, with base added once, the way socialImage is.

Before → after

---
title: Mirror
head:
  - tag: link
    attrs: { rel: canonical, href: https://origin.example/mirror }
---
<!-- before -->
<link rel="canonical" href="https://docs.example.com/mirror/">
<meta property="og:url" content="https://docs.example.com/mirror/">
<link rel="canonical" href="https://origin.example/mirror">

<!-- after -->
<link rel="canonical" href="https://origin.example/mirror">
<meta property="og:url" content="https://origin.example/mirror">

No config, API, type or user-owned file changes. Pages that author no canonical are unchanged. A route that computes a canonical passes it as a head element.

Checks

  • pnpm --filter @cloudflare/nimbus-docs typecheck: pass
  • pnpm lint: pass
  • test/head-seo-build.test.ts (4 tests, with new assertions for an absolute canonical, a site path, a site path under base, and pages without one): pass. The new assertions fail on main with two canonical links.
  • test/api-query-versions-build.test.ts, test/api-page-assets-build.test.ts (the other head assertions): pass

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-authored-canonical.nimbus-docs.com (commit adbb51d)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c99a7f5f.nimbus-docs.com adbb51d 2026-10-26T13:59:37.702Z Visit the dashboard ↗

@MohamedH1998
MohamedH1998 marked this pull request as ready for review October 28, 2026 10:39
@MohamedH1998
MohamedH1998 merged commit adcaacc into main Oct 28, 2026
42 checks passed
@MohamedH1998
MohamedH1998 deleted the fix/authored-canonical branch October 28, 2026 10:48

This branch was successfully deployed

1 active deployment
cloudflare — adbb51dd Deployed Oct 28, 2026 by MohamedH1998 via Delete closed PR Preview #54
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