How to add JSON-LD structured data to a page
JSON-LD is a block of schema.org facts, placed in a script tag, that tells search engines what a page is about. SeenLens fails a page with no JSON-LD block. Adding one takes about 15 minutes per template. It supports Google rich results. It has no proven effect on AI citations, so add only markup that matches the visible page.
By SeenLens · Last updated
Run the free 43-check scan on your page
What does the JSON-LD check test?
The check looks for script elements with type application/ld+json in the HTML your server sends. It fails when it finds none and no other schema.org markup. It passes when it finds at least one block, and the evidence lists the types, such as Organization or Article.
The check counts blocks. Whether the JSON parses is a separate check: JSON-LD syntax errors. Whether the types describe the site owner is another: Organization schema.
Does JSON-LD help AI search?
Google uses structured data to understand a page and to show rich results. Google lists JSON-LD, Microdata and RDFa as supported formats and recommends JSON-LD. Google also says generative AI search does not require structured data or any special schema.org markup.
Ahrefs measured the effect on AI citations (published 2026-05-11). The study followed 1,885 pages that added JSON-LD between August 2025 and March 2026 against 4,000 control pages. It found no significant change in Google AI Mode (+2.4%) or ChatGPT (+2.2%), and a small decline in Google AI Overviews (-4.6%) that the authors say may not come from schema. The study covered pages that already had citations.
Add JSON-LD for rich result eligibility and for a clear statement of who and what the page is. Do not expect more AI citations from it.
How can I check if my page has JSON-LD?
curl -s https://example.com/page | grep -c 'application/ld+json'A result of 0 confirms the problem. If the block shows in your browser but not in this output, a script adds it after load. Many crawlers do not run scripts, so render the block on the server.
How do I add JSON-LD?
Pick the type that matches the page. Use the same text that visitors see.
| Page | Type | Google rich result |
|---|---|---|
| Home page | Organization and WebSite | Organization details, site name |
| Blog post or news article | Article | Byline date, article features |
| Product page | Product | Product snippets |
| Any inner page | BreadcrumbList | Breadcrumb trail |
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to add JSON-LD",
"datePublished": "2026-11-06",
"dateModified": "2026-11-06",
"author": { "@type": "Person", "name": "Jane Doe" }
}
</script>Google accepts the script tag in the head or the body.
Next.js App Router
The Next.js documentation recommends rendering JSON-LD as a script tag in a layout.js or page.js component. It warns that JSON.stringify does not sanitize strings, and suggests replacing the < character with its unicode escape. Use a native script tag, not next/script.
export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const post = await getPost(slug);
const jsonLd = {
"@context": "https://schema.org",
"@type": "Article",
headline: post.title,
datePublished: post.published,
dateModified: post.updated,
};
return (
<article>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(jsonLd).replace(/</g, "\\u003c"),
}}
/>
{/* page content */}
</article>
);
}WordPress
Use an SEO plugin that outputs schema. Yoast SEO documents a JSON-LD graph on every page with Organization (or Person), WebSite and WebPage pieces, plus Article and breadcrumb pieces where they apply. Check the page source after you turn it on. Do not run two plugins that both print the same types. Duplicate Organization blocks confuse parsers.
Shopify
Shopify has a structured_data Liquid filter. It turns a product into Product (or ProductGroup, when the product has variants) and an article into Article. Many themes already print it, so search the theme code for structured_data before you add a second block.
<script type="application/ld+json">
{{ product | structured_data }}
</script>Static sites
Paste the script tag into the page template or layout. Fill the values from front matter so each page gets its own headline and dates.
How do I verify the fix?
- Run the curl command. The count must be 1 or more.
- Open the Google Rich Results Test for Google features, or the Schema Markup Validator for general schema.org checks.
- Scan the page with SeenLens. The evidence line lists the types it found.
When can I ignore this check?
A page with no matching Google feature gains little from extra types. Do not mark up content that visitors cannot see. Google says not to add structured data about information that is not visible to the user. The check has weight 5 in the structured data dimension, so a simple, honest Organization and WebSite block on the home page is a good start.
Sources
- Google Search Central: Introduction to structured data (formats, placement, markup must match visible content; checked 2026-11-06)
- Google Search Central: Optimizing your website for generative AI features (no structured data required for generative AI search; checked 2026-11-06)
- Ahrefs: Does schema help AI citations? (1,885 pages and 4,000 controls, published 2026-05-11; vendor study; checked 2026-11-06)
- Next.js docs: JSON-LD (script tag pattern and escaping; page updated 2026-03-02; checked 2026-11-06)
- Yoast developer docs: Schema functional specification (default graph pieces; checked 2026-11-06)
- Shopify Liquid: structured_data filter (Product, ProductGroup and Article output; checked 2026-11-06)