Blog / AI & search /
Using AI to write schema markup
You ask an AI to write product schema. Three seconds later you have a lovely, tidy block of JSON-LD. It also includes a 4.8-star rating that doesn’t exist, the wrong product URL and a property that sounds real but isn’t.
That’s the danger of asking AI for schema without giving it accurate source data and checking every field.
AI can help you draft or explain structured data. It can’t verify the page unless it has reliable access to it. You remain responsible for matching the markup to the visible content, the current search documentation and the site’s real product or organisation records.
Start with the page and its purpose
Before writing code, identify the page type. Is it a product page, an article, a local business page, a recipe or something else? Choose a schema type that describes the page, not the rich result you hope to earn. A type should represent real content and relationships.
Gather the facts from a trusted source: page title, canonical URL, author, publication date, price, currency, stock status, review details or business contact information, as relevant. Note which facts are visible on the page and which are missing. Never prompt the model to fill gaps with typical values.
Start small and ask the model for a draft with placeholders for missing data instead of guesses. Better still, give it a structured input that separates known values from unknown ones. If a property isn’t known or supported, leave it out or ask the owner.
Give the model constraints
A good prompt names the vocabulary and format, the page the markup describes, the source of each value and the fields that must not be invented. Ask for the code plus a short note on any assumptions, and tell it to flag missing information instead of choosing defaults.
A prompt can’t enforce accuracy. The model may still emit a fabricated value, follow outdated advice or confuse schema.org properties with Google’s requirements for a search feature. I treat generated JSON-LD like code from a stranger and review it line by line.
If the task involves a recent Google feature or policy, check the official Search Central documentation for the page’s date. Structured data requirements change. A model may cite an old guide or merge requirements from different rich results. Do not ask it to decide whether a page is eligible without verifying the current rules.
Check the output in three ways
First, check the facts. Compare every property with the page and the source system. The price, currency, availability, ratings, author and dates should be correct. Any property that cannot be confirmed should not be published.
Second, check syntax and eligibility. Parse the JSON-LD and test the page with Google’s Rich Results Test where applicable. A general schema validator may confirm that the vocabulary is valid, but it may not check Google’s feature requirements. Fix errors that prevent parsing or eligibility; consider warnings in context rather than stuffing every optional field into the page.
Third, check the rendered page. Confirm the markup appears once, is associated with the right URL and matches what users can see. A theme, plugin and custom script may all output the same entity. Duplicate or contradictory Product or Article data can be harder to debug than missing markup.
Avoid common AI schema mistakes
Models can confuse a product review with customer reviews, add an aggregate rating that the store does not display, or use a generic Organization entity when the page is about a particular product. They may place data inside the wrong nesting structure or use a property that belongs to a different type.
Another classic: a complete-looking block built from incomplete facts. If the page shows no shipping policy or return period, don’t invent one. If the business has several locations, one address doesn’t apply to every branch. Honest gaps beat fabricated completeness.
Do not hide schema in an unreviewed plugin field or publish directly to a live theme from a generated response. Test on staging or a representative page, keep the original code, and record who approved the change. For ecommerce, verify checkout and product variants as well as the markup.
Use AI for explanation and review
I find AI more useful as a tutor or second reviewer than as an author. Give it markup and ask it to explain the properties in plain English, or to spot fields with no visible source. Then check its answers yourself. It can help you understand a specification. It doesn’t replace the specification.
A human review should ask: what entity does this represent? Where did each value come from? Is the information visible? Does the page meet the feature’s rules? Who will update it when the data changes? If those questions have no answer, pause deployment.
Keep a source map with the code
For each non-obvious value, note where it came from: the product database, visible page copy, an approved policy or an author record. This makes future updates less dependent on guessing. If the source changes, the team can identify which markup needs review. A small mapping is especially useful when the same product data appears in a theme, an SEO plugin and a feed, because those systems may not update together.
Related reading
- Schema markup on WordPress: where to start
- Structured data warnings that aren’t worth fixing
- AI and E-E-A-T: adding the experience AI can’t
Use AI to draft schema for a test page, then trace every value back to the visible page or an approved source. Which field would you delete if you couldn’t verify it?