feat(io): add Organization/WebSite/Breadcrumb/Product JSON-LD for ric…#39
Merged
Conversation
…h results
Adds a small shared JSON-LD toolkit (src/lib/seo/{site,schema}.ts,
src/lib/components/JsonLd.svelte) and wires the still-eligible Google structured
-data enhancements:
- Organization + WebSite once site-wide (root layout)
- BreadcrumbList: Breadcrumbs.svelte now delegates to the shared breadcrumbSchema
- Product: one per sensor module on /replacement-sensors + one on /replacement-case
(bare Products - no fabricated ratings)
FAQ/HowTo intentionally omitted (Google deprecated both rich-result types).
schema.ts + JsonLd.svelte are byte-identical to the Japan-website branch; only
site.ts differs. Verified in the prerendered build: exactly one Org+WebSite per
page, valid JSON, correct escaping and @id cross-refs.
TODO(confirm): .io Organization sameAs URLs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a shared JSON-LD (schema.org) toolkit and wires structured data across the site to support Google’s still-relevant rich-result enhancements (site publisher identity, breadcrumbs, and product entities).
Changes:
- Introduces reusable JSON-LD builders (
src/lib/seo/{site,schema}.ts) and a<JsonLd>head-injection component. - Emits site-wide
Organization+WebSitestructured data once from the root layout. - Emits
BreadcrumbListfromBreadcrumbs.sveltevia the shared builder, and addsProductJSON-LD to the replacement sensors/case pages.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/replacement-sensors/+page.svelte | Adds per-sensor Product JSON-LD emission for the replacement sensors page. |
| src/routes/replacement-case/+page.svelte | Adds a single Product JSON-LD entity for the replacement case page. |
| src/routes/+layout.svelte | Injects site-wide Organization + WebSite JSON-LD once per page. |
| src/lib/seo/site.ts | Defines cropwatch.io site constants and org identity used by structured data builders. |
| src/lib/seo/schema.ts | Adds schema.org JSON-LD builder functions (Organization, WebSite, BreadcrumbList, Product, etc.). |
| src/lib/components/JsonLd.svelte | New component to serialize JSON-LD into <head> safely. |
| src/lib/components/Breadcrumbs.svelte | Switches breadcrumb JSON-LD emission to the shared builder + <JsonLd>. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+13
to
+15
| <svelte:head> | ||
| {@html `<script type="application/ld+json">${json}<\/script>`} | ||
| </svelte:head> |
Comment on lines
23
to
27
| export interface Crumb { | ||
| label: string; | ||
| /** Absolute or root-relative path. Omit on the final (current) crumb. */ | ||
| href?: string; | ||
| } |
Comment on lines
+107
to
+114
| const out: Json = { | ||
| '@context': 'https://schema.org', | ||
| '@type': 'Product', | ||
| name: p.name, | ||
| description: p.description, | ||
| brand: { '@type': 'Brand', name: 'CropWatch' }, | ||
| manufacturer: { '@id': ORG_ID } | ||
| }; |
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.
…h results
Adds a small shared JSON-LD toolkit (src/lib/seo/{site,schema}.ts, src/lib/components/JsonLd.svelte) and wires the still-eligible Google structured -data enhancements:
FAQ/HowTo intentionally omitted (Google deprecated both rich-result types). schema.ts + JsonLd.svelte are byte-identical to the Japan-website branch; only site.ts differs. Verified in the prerendered build: exactly one Org+WebSite per page, valid JSON, correct escaping and @id cross-refs.
TODO(confirm): .io Organization sameAs URLs.