How to Add JSON-LD to a Website
JSON-LD is the format Google prefers: a small script you drop into the page — no plugins required, no visible change to your layout.
- Choose the right type. Match the schema to the page's main content — a shop page gets Product, a blog post gets Article, your homepage gets Organization + WebSite.
- Copy a template from the Schema Types library and replace every
YOUR_...placeholder with real values. - Content parity check. Every value you mark up (price, hours, rating, address) must already be visible on the page. Hidden or invented data violates Google's spam policies.
- Paste before
</head>. The whole block goes in the page source, not in a text editor or widget that escapes HTML. - Platform specifics:
- Plain HTML: paste directly in
index.htmlhead section. - WordPress: WPCode → Header Code, or Rank Math / Yoast schema field. Never the visual editor.
- Shopify: Online Store → Themes → Edit code →
theme.liquid. - Wix / Squarespace: Settings → Custom Code / Code Injection → Header.
- Plain HTML: paste directly in
- Publish, purge cache/CDN, then view source (
Ctrl+U) and searchapplication/ld+json— it must appear, exactly once per entity type. - Validate the live URL with the tools in Tools and inspect it in Search Console.
@id from other pages.
Validate Your Markup
Never ship unvalidated schema. Two free tools, two different jobs.
1. Schema.org Validator
Checks pure syntax and vocabulary correctness. Pass the code with no errors; warnings (optional property unused) are acceptable.
Open tool →2. Google Rich Results Test
Checks eligibility for Google's rich features: parses the code (or a live URL) and lists errors that would block a rich result.
Open tool →Fix checklist — most common errors
- Trailing comma or missing brace (JSON has no comments)
- Smart quotes
“instead of straight" - Unescaped
&or quotes inside strings - Wrong enum:
https://schema.org/InStock, not"InStock" - Times not in 24h
HH:MM, dates not ISO 8601 - Rating values as strings are fine; ranges beyond bestRating are not
Verify after publishing
- View source → script present once
- Rich Results Test on the live URL
- Search Console → URL Inspection → Test live URL
- Check rendered HTML (Google must not see the block removed by JS)
- Re-test after every theme or plugin update
Rich Results Eligibility
Valid markup makes you eligible — Google decides whether to display it. Eligibility is necessary but not guaranteed.
Technical eligibility
Correct type, all required properties, no parse errors, crawlable page. That gets you into the running.
Quality signals
Useful content, authority, good Page Experience. Rich results are disproportionately shown to pages that already rank well.
Policy compliance
Markup matches visible content; no fake reviews, hidden text, or fabricated offers. Violations trigger manual actions.
NAP Consistency for Local SEO
Name, Address, Phone — the trio that must match everywhere your business appears.
Where NAP must match
- Your LocalBusiness JSON-LD
- Website footer and contact page
- Google Business Profile (verified)
- Apple Maps, Bing Places, Yelp, Facebook
- Industry directories and citations
Rules of thumb
- Same legal name & abbreviation policy everywhere
- Use E.164-ish format:
+1-555-555-5555 - One canonical address spelling (St vs Street — pick one)
- Keep hours synced between GBP and markup
- Update all citations within 48h of any change