Skip to content

fix: add self-canonicals for sitemap routes - #91

Merged
sarthakagrawal927 merged 1 commit into
mainfrom
fix/sitemap-canonicals
Aug 15, 2026
Merged

fix: add self-canonicals for sitemap routes#91
sarthakagrawal927 merged 1 commit into
mainfrom
fix/sitemap-canonicals

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

Closes #86

Summary

Seven public sitemap URLs either lacked a self-canonical or pointed at extension-suffixed variants. This makes PUBLIC_CANONICALS the single source of truth for every public sitemap route's exact, extensionless self-canonical and adds a contract test that prevents future drift.

Changes

  • src/lib/public-canonicals.ts — registers all nine public sitemap routes (home, discover, project-preview, tools, catalog-updates, changelog, about, privacy, terms) with exact self-canonical paths; exports PUBLIC_CANONICAL_PATHS.
  • src/app/sitemap.ts — builds sitemap URLs from PUBLIC_CANONICALS so the sitemap and canonical cannot drift; the homepage entry now matches its canonical trailing slash.
  • src/app/page.tsx — adds a homepage self-canonical (/) to the Next.js fallback page metadata (production home is the Astro overlay, whose canonical is already emitted by the Astro layout).
  • src/app/about/page.tsx / src/app/catalog-updates/page.tsx — route their alternates.canonical through PUBLIC_CANONICALS instead of literal strings.
  • src/__tests__/sitemap.test.ts — replaced with a sitemap/canonical contract test asserting:
    • sitemap advertises only the real public routes in canonical order;
    • full parity: sitemap pathnames === registered canonicals (no drift either way);
    • every canonical is extensionless and self-referential;
    • the seven named public surfaces (home, discover, project-preview, tools, changelog, privacy, terms) are registered;
    • canonicalPath maps the Astro .html overlays (index.html, changelog.html, …) to the registered extensionless canonicals.

Notes

  • The Astro-served home and changelog pages already emit correct self-canonicals via landing-astro/src/layouts/Layout.astro + canonicalPath; this formalizes them in the registry and pins them with the contract test.
  • No product behavior or visible UI changes. Routes and navigation are preserved.

Verification

pnpm quality   # check + typecheck + test:coverage + docs:check + code-health gates — green (215 tests)

Closes #86

- Register all nine public sitemap routes (home, discover, project-preview,
  tools, catalog-updates, changelog, about, privacy, terms) in
  PUBLIC_CANONICALS as the single source of truth for exact, extensionless
  self-canonicals.
- Add a homepage self-canonical ('/') to the Next.js fallback page metadata.
- Route about and catalog-updates canonicals through PUBLIC_CANONICALS so
  every sitemap URL's canonical is derived from the registry.
- Build sitemap URLs from PUBLIC_CANONICALS so the sitemap and canonical
  cannot drift; the homepage entry now matches its canonical trailing slash.
- Replace the sitemap test with a sitemap/canonical contract test asserting
  full parity (sitemap paths === registered canonicals), extensionless
  self-referential values, the seven named public surfaces, and that
  canonicalPath maps the Astro .html overlays to the registered canonicals.
@sarthakagrawal927
sarthakagrawal927 merged commit 21d9cda into main Aug 15, 2026
1 check passed
@sarthakagrawal927
sarthakagrawal927 deleted the fix/sitemap-canonicals branch August 15, 2026 07:12
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.

Fix missing and extension-suffixed sitemap canonicals

1 participant