How to Implement Schema
There are only a few ways to get schema onto a website. Pick the one that matches your platform, follow the steps, then test it. That's the whole job.
Step 1: Check what's already there
Before you add anything, find out what your site already says. Many platforms, themes, and plugins write some schema for you, and adding a second copy on top is the most common mistake.
- Open your homepage in a browser and view the source: Cmd+Option+U on a Mac, Ctrl+U on Windows.
- Search the page (Cmd+F or Ctrl+F) for
ld+json. - Count the results. Each one is a block of schema. Note who made it: a class like
yoast-schema-graphmeans Yoast, and comments or class names usually give away the theme or plugin.
No results? You're starting fresh. One or two? Your job is to configure what's there and fill the gaps. Several, describing your business differently? Clean those up first.
Faster optionPaste your URL into the Schema Markup Validator. It lists every schema item it finds on the page, in a readable tree.
Step 2: Pick your path
WordPress + Yoast
Configure the plugin. It writes the foundation for you. Best for most WordPress sites.
Path BWordPress by hand
Add your own JSON-LD with a snippets plugin or theme code. For types Yoast doesn't cover, or no SEO plugin at all.
Path CWebsite builders
Webflow, Squarespace, Wix, Shopify, Framer. Paste JSON-LD into the page's custom code settings.
Path DCustom sites
Static HTML, React, Next.js, headless CMS. Put it in the template and generate it from your data.
Path A: WordPress with Yoast
Yoast SEO outputs a connected graph on every page: your Organization (or Person), WebSite, WebPage, breadcrumbs, and, on posts, Article and author. You don't write that code. You give Yoast accurate information.
- Site basics (Yoast SEO → Settings → Site basics): your real brand name and a one-line tagline.
- Site representation: choose Organization or Person, add your name, a logo, and your official social profiles.
- Content types: keep pages as Web Page; set posts to Article or Blog Post.
- Special pages: in the editor's Yoast Schema tab, set your About page to About Page and Contact page to Contact Page.
- Author profiles: fill in each author's name, bio, and links under Users → Profile.
That covers the foundation. For anything Yoast doesn't do (Service, Event, Recipe, reviews), use Path B below and point your new markup at Yoast's Organization by its @id.
Using Rank Math or All in One SEO instead? Same idea: find the plugin's schema or "local SEO" settings, fill in your business details, then check the output. Just don't run two SEO plugins at once.
Full Yoast guide: every setting, what it covers, and how to extend it →
Path B: WordPress by hand
Use this when you need a type your SEO plugin doesn't cover, or you'd rather control the markup yourself. Pick the option that matches your comfort level.
Option 1: A code snippets plugin (no theme editing)
- Install a code snippets or "header and footer" plugin. Look for one that can add code to the
<head>of specific pages. - Create a new snippet, choose HTML, and paste your JSON-LD wrapped in its script tag.
- Set it to load only on the page it describes, for example only on your letterpress service page.
- Save, clear any caching plugin, and test.
Option 2: Theme code (for developers)
In a child theme's functions.php or a small custom plugin, hook into wp_head. Building the data as a PHP array and encoding it with wp_json_encode means you never hand-type JSON punctuation:
add_action( 'wp_head', function () {
if ( ! is_page( 'letterpress-printing' ) ) {
return;
}
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'Service',
'name' => 'Letterpress Printing',
'url' => get_permalink(),
'provider' => array( '@id' => home_url( '/#organization' ) ),
);
echo '<script type="application/ld+json">' . wp_json_encode( $schema ) . '</script>' . "\n";
} );
The provider line points to the Organization that Yoast already describes, so the two connect instead of competing.
Option 3: A purpose-built plugin
Some content types have plugins that handle schema as a side effect. Recipe card plugins output Recipe schema; events calendar plugins usually output Event schema. If you use one, check its output before writing your own.
Avoid duplicatesIf Yoast (or your theme) already describes your Organization, don't paste a second Organization block. Reference it by @id instead. Two different descriptions of the same business confuse machines.
Path C: Website builders
Every major builder has a place for custom code in the page's <head>. The steps are the same everywhere: find that box, paste your JSON-LD (with its <script type="application/ld+json"> wrapper), publish, test. Menu names change over time, so use these as directions, not exact paths.
| Platform | Where to paste it | Good to know |
|---|---|---|
| Webflow | Page settings → Custom code → "Inside <head> tag." Site-wide code lives in Site settings. | On CMS template pages, you can insert CMS fields into the JSON, so every blog post gets its own Article schema automatically. |
| Squarespace | Page settings → Advanced → page header code injection. Site-wide: Settings → Code injection. | Squarespace adds some basic schema on its own. Code injection depends on your plan. |
| Wix | Page SEO settings → Advanced SEO → Structured data markup. | Wix generates schema for some page types already. Edit or add to it there rather than duplicating it. |
| Shopify | Theme code (theme.liquid or the relevant template), or a schema app. | Most themes already output Product schema. Check product pages before adding more. |
| Framer | Page settings → Custom code → head. Site-wide code in Site settings. | Use page-level code for page-specific types like Service or Event. |
Tip: put site-wide schema (Organization and WebSite) in the site-wide code area once, and page-specific schema (Service, Event, Article) on the individual page.
Path D: Custom sites (HTML, React, Next.js, headless)
On a site you build yourself, schema is just part of the template.
- Static HTML: paste the script block into the
<head>of each page. - Templates and frameworks: build the schema as an object from the same data that renders the page (title, date, author, price), then output it with
JSON.stringify. The data stays in sync, and the JSON is always valid. - Render it on the server. Put the schema in the HTML the server sends, not in JavaScript that runs later in the browser. Google can usually handle either, but many AI crawlers don't run JavaScript at all, so client-only schema may never be seen.
See Lesson 3 for a full React / Next.js example →
A starter block for any site
If you're starting from nothing, this is the foundation: who you are and what the site is. Swap in your details and add it site-wide.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": "https://www.example.com/#organization",
"name": "Your Business Name",
"url": "https://www.example.com/",
"logo": "https://www.example.com/logo.png",
"sameAs": [
"https://www.linkedin.com/company/your-business/",
"https://www.instagram.com/yourbusiness/"
]
},
{
"@type": "WebSite",
"@id": "https://www.example.com/#website",
"name": "Your Business Name",
"url": "https://www.example.com/",
"publisher": { "@id": "https://www.example.com/#organization" }
}
]
}
</script>
Then add page-specific types as you need them. The lessons have a ready-to-edit example for each one.
Step 3: Test it
Testing takes five minutes and catches almost every problem. Do it after you add schema, and again after big theme, plugin, or design changes.
- Check the source. View source and search for
ld+json. Is your new block there? Is there only one of each type you meant to have? - Validate the markup. Paste the live URL into the Schema Markup Validator. It catches broken JSON and misspelled properties, for every schema type.
- Check Google eligibility. Run the URL through Google's Rich Results Test. It shows which rich results the page qualifies for, and any missing required fields. (It only reports types Google shows as rich results, so a Service block won't appear there. That's normal.)
- Watch it over time. In Google Search Console, use URL Inspection on key pages and check the rich result reports for errors after Google recrawls.
| Tool | What it tells you | Use it when |
|---|---|---|
| View Source | What's actually on the page, including duplicates | Always, first |
| Schema Markup Validator | Whether the markup is valid Schema.org, for any type | Every time you add or change schema |
| Rich Results Test | Which Google rich results the page is eligible for | Products, recipes, events, reviews, articles, breadcrumbs |
| Search Console | How Google sees your pages over time | Monthly, and after site changes |
Lesson 15 goes deeper: common errors and how to fix them →
Implementation checklist
- I checked what schema the site already had before adding anything.
- Organization and WebSite are described once, site-wide, with consistent details.
- Page-specific schema lives only on the page it describes.
- Anything I added points to the main Organization by
@id. - Every fact in the schema is visible on the page.
- The schema is in the HTML the server sends, not added later by JavaScript.
- The Schema Markup Validator shows no errors.
- The Rich Results Test shows the features I expected, where they apply.
- I know who updates the schema when the site changes.
New to the code? Start with Lesson 1. Using Yoast? Read the Yoast guide. Wondering why it's worth the effort? See Why Schema Is Important.