How to add schema markup to your website
·4 min read
Here is how to add schema markup to your website. Choose the schema.org type that matches each page, write it as JSON-LD, and put it in a <script type="application/ld+json"> tag in the HTML your server sends. Then test the live URL and watch Search Console for errors. On WordPress, Shopify and Webflow, a plugin or the theme often prints some markup already, so check what is there before you add more.
One rule sits above the syntax. Google's structured data guidelines say "Don't mark up content that is not visible to readers of the page." Every price, rating and date in your JSON-LD has to appear on the page too, or you risk a manual action that removes the page's rich results.
Pick one type per page
Use the type that describes the main thing on the page. A home page gets Organization and WebSite, a post gets BlogPosting or Article, a product page gets Product with an Offer, and a location page gets a LocalBusiness subtype such as Dentist. Our schema markup guide lists every type, what it can earn in search and which pages should carry it.
Use a JSON-LD generator or write it by hand
A JSON-LD generator saves you from missing commas, which matter because one syntax error makes the whole block unreadable. Here is a blog post written by hand:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "How we cut checkout time in half",
"image": "https://example.com/images/checkout.jpg",
"datePublished": "2026-09-14T08:00:00+00:00",
"author": { "@type": "Person", "name": "Dana Ruiz" },
"publisher": {
"@type": "Organization",
"name": "Example Co",
"logo": { "@type": "ImageObject", "url": "https://example.com/logo.png" }
}
}
</script>Use absolute URLs, write dates in ISO 8601 with a time zone, and copy values from the page instead of retyping them. If the syntax is new to you, read what JSON-LD is.
The tag can go in the <head> or the <body>, per Google's introduction to structured data. Several blocks on one page are fine as long as they agree.
How to add schema markup in WordPress
Start by finding out what your SEO plugin already prints. Yoast SEO outputs a graph on every page with WebPage, WebSite and an Organization or Person, plus Article on posts, per its schema documentation. Rank Math adds WebPage and WebSite by default and sets a schema type per post type under Rank Math SEO > Titles & Meta, per its schema docs.
Duplicates are the common WordPress problem. WooCommerce prints its own Product and BreadcrumbList markup, many themes print theirs, and a second SEO plugin left active adds a third. Pick one source per type and switch the others off.
For a type your plugin doesn't cover, a short function in a child theme prints the block on the one page that needs it:
add_action( 'wp_head', function () {
if ( ! is_page( 'contact' ) ) {
return;
}
$data = array(
'@context' => 'https://schema.org',
'@type' => 'Dentist',
'name' => 'Example Dental',
'url' => 'https://example.com/',
'telephone' => '+1-555-010-0100',
);
echo '<script type="application/ld+json">' . wp_json_encode( $data ) . '</script>';
} );How to add structured data on other platforms
The method changes by platform, but the block always has to be in the HTML the server returns.
Shopify
Dawn, Shopify's reference theme, already prints Product and Article markup with the Liquid structured_data filter. To change it, go to Online Store > Themes, open the three-dot menu and choose Edit code, after duplicating the theme as Shopify recommends. Before installing a reviews or SEO app, search the theme for ld+json so you don't ship two Product blocks.
Webflow
Page settings has a Schema markup section for your own JSON-LD, per Webflow's help center. On a Collection template, Webflow's SEO guide has you fill property values from CMS fields so every item gets its own markup.
Next.js
The Next.js JSON-LD guide says to render a native <script> tag in a page or layout, not next/script, and to replace < so data can't close the tag:
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd).replace(/</g, "\\u003c") }}
/>Avoid adding schema through a tag manager
Use Google Tag Manager only when you can't edit templates. Google reads JSON-LD that JavaScript adds when it renders the page, but warns that copied values can drift from the page and that dynamic Product markup can make Shopping crawls less reliable. Crawlers that don't run scripts, including the main AI crawlers, never see it, as our JavaScript SEO guide explains.
How to test your schema markup
Test the code before publishing and the live URL after. Our guides to structured data testing tools and the Rich Results Test cover each validator. Then view source and confirm the block is in the server HTML, because the Rich Results Test runs JavaScript and other crawlers don't.
The Schema Markup Checker reads every JSON-LD block in the HTML your server sends and lists parse errors, missing properties and duplicate WebSite nodes. It costs 8 credits a run.
Monitor rich result reports after launch
Search Console shows a rich result report for each supported type it finds, with valid and invalid items. Syntax errors go to the Unparsable structured data report. After a fix, click Validate fix, which usually takes up to about two weeks. Recheck after every theme or plugin update, since that is how duplicates come back.
Generate JSON-LD for your page
Our Schema Markup Generator builds JSON-LD from the fields you fill in, for 16 types including Article, BlogPosting, Organization, Product, LocalBusiness, Event, Recipe and VideoObject. It checks the result against the same rules as the Schema Markup Checker, so a missing required property shows up before the code reaches your site. It fetches nothing, doesn't choose the type for you, and doesn't publish anything. A run costs 3 credits.