--- name: seo-structured-data description: "Design, implement and validate JSON-LD structured data in a codebase: choose types that match visible content, build one @graph with stable @id entities, render it server-side and safely escaped, validate syntax, structure and Google feature requirements, and remove fabricated or ineligible markup such as self-serving reviews, placeholder values and retired rich-result types. Use when adding schema, fixing Rich Results errors, reviewing schema produced by CMS plugins or templates, or auditing component templates. Not for deciding entity facts such as sameAs or organization identity (geo-entity-authority)." --- # Structured data (JSON-LD) Design, implement and validate JSON-LD that describes what each page actually shows, in the code that renders it. The bundled CLI checks syntax, structure, placeholders, escaping and Google's required properties; you choose types from visible content and the [structured data matrix](../../references/structured-data-matrix.md). ## Use when / hand off Use when: - adding or changing JSON-LD in layouts, page templates, components or CMS themes; - Search Console enhancement reports or a Rich Results Test show errors (the user supplies them); - reviewing markup emitted by plugins (Yoast, Rank Math, All in One SEO, Shopify apps) or a theme; - removing fabricated, invisible, self-serving or placeholder markup; - a layout refactor might break existing JSON-LD. Hand off: - entity facts (legal name, logo, `sameAs`, founders, authors' profiles) → [geo-entity-authority](../geo-entity-authority/SKILL.md); this skill only renders them; - Product, Offer, variants, shipping and return policies → [seo-ecommerce](../seo-ecommerce/SKILL.md); - LocalBusiness, NAP and location pages → [seo-local](../seo-local/SKILL.md); - VideoObject and image discoverability → [seo-media](../seo-media/SKILL.md); - review and rating content on the page itself → [seo-content](../seo-content/SKILL.md); - making JSON-LD checks a CI gate → [seo-ci-guard](../seo-ci-guard/SKILL.md). ## Before you change anything 1. Read the repository's agent and contributor instructions (`AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md`) and follow them where they are stricter than this skill. 2. Define the CLI: `SG` means `python3 -I /scripts/seo_geo.py`, where `` is two directories above this SKILL.md (Claude Code: `${CLAUDE_PLUGIN_ROOT}`). `-I` keeps `PYTHONPATH`, user site-packages and the current directory out of the import path. 3. Run `SG stack .` (or reuse its result from this session) for the framework, build output directory, base URL candidates and metadata locations. 4. Locate every emitter of JSON-LD before editing: `rg -n "application/ld\+json" --glob '!node_modules' .`, plus head APIs (`generateMetadata`, `useHead`, ``), theme partials (`layouts/partials/`, `snippets/`, `header.php`) and plugin settings. Look especially for two emitters of the same entity, such as a theme and a plugin both printing Organization. 5. Check for a verified entity file at `.seo-geo-god/entity.json` (owned by geo-entity-authority). Without it, Organization and Person values come only from the user or from visible site content. 6. Confirm the evidence source: a local build (default), a local production server for server-rendered apps, or a live site only with the owner's explicit consent and `--live`. 7. List the data you have (Search Console enhancement exports, Rich Results Test output, Merchant Center diagnostics) and state plainly what is missing; without them, eligibility after deployment is unverified. ## Workflow 1. **Inventory.** - Built output: `SG jsonld dist` lists blocks, types and findings per file. - Source templates: `SG jsonld src --recursive` checks `.tsx`, `.jsx`, `.vue`, `.svelte`, `.astro`, `.php`, `.liquid`, `.njk`, `.erb`, `.ejs` and `.hbs` files. Blocks containing template expressions are skipped as [SD019](../../references/rule-catalog.md#sd019); validate those in built output. - Server-rendered apps: build, start the production server and run `SG audit-url http://localhost:3000 --live --allow-local localhost:3000 --max-pages 50`. - Plugin-injected markup can be missing from a raw fetch and present after rendering; confirm in a rendered DOM (host browser tools) before calling it missing or duplicated. 2. **Decide types** from what each template shows, using the matrix: | Page | Types | Notes | | --- | --- | --- | | Home | Organization + WebSite in one `@graph` | WebSite supports site names; no SearchAction needed | | Article, post, guide | Article, BlogPosting or NewsArticle + BreadcrumbList | No required properties; author as a Person with a real profile URL | | Product detail | Product with Offer | Product snippet or merchant listing; hand details to seo-ecommerce | | Category or listing | BreadcrumbList; ItemList only if it matches the visible items | Never mark every card as an Article or Product | | Location or branch | LocalBusiness subtype | name and address required; hand details to seo-local | | Video watch page | VideoObject | Only where the video is the main content | | Author or member profile | ProfilePage with Person | | | Forum thread, community Q&A | DiscussionForumPosting or QAPage | QAPage only for real user questions and answers | | Single real event | Event | Not for event listings | | Software or app | SoftwareApplication | Needs offers.price and a real rating or review for the feature | | FAQ section written by the site | none for rich results | FAQ rich results are no longer shown | 3. **Implement from templates.** Start from `templates/jsonld/` in the plugin (`organization-website.graph.json`, `article.json`, `breadcrumb.json`, `product-merchant.json`, `local-business.json`, `video.json`, `profile-page.json`, `software-application.json`). Replace every `[REPLACE: …]` token with values from the page's own data or the verified entity file; a token left behind is [SD006](../../references/rule-catalog.md#sd006). - Build the object from the same fields the template renders (props, CMS fields, database rows), never from hard-coded copies. - One `@graph` per page with stable `@id` values: `/#organization`, `/#website`, `#webpage`. - Serialize with the language's JSON encoder and escape `<`. Next.js App Router component: ```tsx export function JsonLd({ data }: { data: Record }) { return (