fix(registry): locale-correct JSON-LD + schema on all public pages#499
Draft
bntvllnt wants to merge 2 commits into
Draft
fix(registry): locale-correct JSON-LD + schema on all public pages#499bntvllnt wants to merge 2 commits into
bntvllnt wants to merge 2 commits into
Conversation
Page JSON-LD self/breadcrumb URLs were built from ${SITE_URL}${pathname} with
no locale segment, so every /fr/* page emitted English URLs that mismatched its
own canonical. Route all page JSON-LD through canonical(path, locale) — the
pattern /design already used — so structured-data URLs track each page's
canonical per locale.
Also add page-specific structured data to the seven indexable pages that
previously carried only the global Organization+WebSite:
- home: SoftwareApplication
- /components, /vs: CollectionPage + BreadcrumbList
- /vs/shadcn, /components/[slug]/playground: BreadcrumbList
- /philosophy: TechArticle + BreadcrumbList
- /themes: BreadcrumbList
12 pages fixed for the locale bug (incl. build/[slug]); 7 pages gain schema.
Verified in built HTML: /fr/docs breadcrumbs resolve to /fr/docs, /en to /docs.
|
ntk preview
Built from |
…ailLd Close the root cause behind the /fr JSON-LD locale bug and lock it with tests. - lib/jsonld.ts: add breadcrumbTrailLd(locale, trail) — a locale-aware breadcrumb constructor that resolves every crumb through canonical(path, locale) and prepends Home. Migrate all 17 breadcrumb pages to it so no page hand-builds absolute breadcrumb URLs; the locale-correct URL is now the only path, closing the failure mode by construction. - lib/jsonld.test.ts: unit regression test — a non-default locale prefixes every crumb URL, the default locale prefixes none. Mutation-verified: the /fr assertions fail when the helper ignores locale. - e2e/jsonld-locale.spec.ts: page-level guard — /fr/families/form breadcrumb JSON-LD resolves to /fr URLs, /families/form to unprefixed. Catches a page that bypasses the helper.
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 #498
What
Two SEO/structured-data fixes across the registry app.
1.
/frJSON-LD URLs now track the page canonicalPage JSON-LD (
BreadcrumbList,TechArticle,CollectionPage,SoftwareApplication,ItemList) built its self/breadcrumb URLs from${SITE_URL}${pathname}with no locale segment, so every/fr/*page emitted the English URL — mismatching its own locale-prefixedcanonical. Routed all page JSON-LD throughcanonical(path, locale)(the pattern/designalready used). Removes the now-orphaned per-fileSITE_URLconsts. 12 pages (incl.build/[slug], which renders JSON-LD too).2. Structured data added to 7 indexable pages
Previously carried only the global Organization+WebSite:
/homeSoftwareApplication/componentsindexCollectionPage+BreadcrumbList/vsindexCollectionPage+BreadcrumbList/vs/shadcnBreadcrumbList(siblings already had it)/philosophyTechArticle+BreadcrumbList/themesBreadcrumbList/components/[slug]/playgroundBreadcrumbListRedirect pages (
/ai,/docs/changelog) and noindex pages (/embed,/report,/request-component) intentionally excluded.Verification
tsc --noEmit: cleannext build: green — 2706 prerendered pages, all edited routes generated/fr/docsbreadcrumb →…com/fr+…com/fr/docs;/en/docs→…com+…com/docs; newCollectionPage/SoftwareApplication/BreadcrumbListpresent on the gap pages.Follow-up (code-review findings addressed)
Regression test and root-cause helper added in
9931e792:lib/jsonld.ts— newbreadcrumbTrailLd(locale, trail): a locale-aware breadcrumb constructor that resolves every crumb throughcanonical(path, locale)and prepends Home. All 17 breadcrumb pages migrated to it, so no page hand-builds absolute breadcrumb URLs — the locale-correct URL is the only path (closes the failure mode by construction, not just by fix).lib/jsonld.test.ts— unit regression test: a non-default locale prefixes every crumb URL, the default locale prefixes none. Mutation-verified (the/frassertions fail when the helper ignores locale).e2e/jsonld-locale.spec.ts— page-level Playwright guard:/fr/families/formbreadcrumb JSON-LD resolves to/frURLs,/families/formto unprefixed. Catches a page that bypasses the helper.Follow-up verification
next buildgreen · eslint clean.