fix: add self-canonicals for sitemap routes - #91
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #86
Summary
Seven public sitemap URLs either lacked a self-canonical or pointed at extension-suffixed variants. This makes
PUBLIC_CANONICALSthe 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; exportsPUBLIC_CANONICAL_PATHS.src/app/sitemap.ts— builds sitemap URLs fromPUBLIC_CANONICALSso 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 theiralternates.canonicalthroughPUBLIC_CANONICALSinstead of literal strings.src/__tests__/sitemap.test.ts— replaced with a sitemap/canonical contract test asserting:canonicalPathmaps the Astro.htmloverlays (index.html,changelog.html, …) to the registered extensionless canonicals.Notes
landing-astro/src/layouts/Layout.astro+canonicalPath; this formalizes them in the registry and pins them with the contract test.Verification