How do I add schema markup (JSON-LD) to my site with Claude Code or Codex?

Ask the agent to generate JSON-LD in your page templates from the same data each page shows, with only types and values a reader can see, rendered on the server. Write that rule in CLAUDE.md or AGENTS.md so every new page gets it. Then test the published URL, not the code, in Google's Rich Results Test.

Facts

Which schema types should I ask the agent to add?

Ask for the type that matches what each page shows, and nothing else:

PageSchema typeKey properties
Home or about pageOrganization (or LocalBusiness)name, url, logo, sameAs
Guide or blog postArticleheadline, author, datePublished, dateModified, publisher
Product pageProductname, offers with the price the page shows
Page with visible questions and answersFAQPageOnly the questions printed on the page

What prompt should I give Claude Code or Codex?

Give it one rule set it can apply to every template, with a ban on invented values:

Add JSON-LD structured data to this site.
- Build it in the page templates from the same data the page renders.
  Never hardcode a value the page does not show.
- Organization (name, url, logo, sameAs) on the home page only.
- Article on guides and blog posts: headline, author, datePublished,
  dateModified (the real last change), publisher = the Organization.
- Product, LocalBusiness or FAQPage only where that content is visible.
- If a value is unknown, leave the property out. Do not invent it.
- Render it on the server, in a <script type="application/ld+json">.
- List every page you changed and the types each one now carries.

Where do I put the rule so new pages get schema too?

Put it in the instructions file the agent loads on its own. Claude Code reads ./CLAUDE.md or ./.claude/CLAUDE.md at the start of each session, and /init creates a first version. Codex reads AGENTS.md from the project root before doing any work. A short rule there keeps the next page the agent writes consistent with the last one.

How do I check the agent did not invent anything?

Test the published URL in the Rich Results Test, then compare each value with the page a reader sees. A URL test runs the page's JavaScript, which pasted code does not. Then use URL Inspection in Search Console to confirm Google found the markup. A valid test only proves the syntax; the values are your job to check.

Will schema markup make ChatGPT or Google AI cite my site?

Not by itself. Google says AI Overviews and AI Mode need no special schema, and it does not guarantee rich results for valid markup. Correct JSON-LD helps search engines read who you are and what the page is; the answer on the page is still what gets quoted.

Step by step

  1. List your page types. Home, about, guides, products: one schema type for each.
  2. Give the agent the prompt. Ask it to build JSON-LD in the templates from the page's own data, with no invented values.
  3. Save the rule. Add it to CLAUDE.md or AGENTS.md so future pages follow it.
  4. Review the diff and deploy. Check that values come from page data, not hardcoded text.
  5. Test the live URL. Run the Rich Results Test on the published page, then URL Inspection in Search Console.

Common mistakes

  • Letting the agent fill in ratings, prices or authors the page does not show.
  • Adding FAQPage markup for questions that are not printed on the page.
  • Testing pasted code instead of the live URL, which misses what JavaScript renders.
  • Setting dateModified on every build instead of when the content changed.

How easyIndex solves it

easyIndex never changes your site: your coding agent writes the pages and the schema, and easyIndex audits each page when submitted and checks it again on the live site after publishing, including whether it carries JSON-LD and a real update date. A step completes on that evidence, not on the agent's report.

Frequently asked questions

JSON-LD, Microdata or RDFa?

JSON-LD. Google supports all three and recommends JSON-LD when your setup allows it.

Can the agent inject JSON-LD with JavaScript?

Google processes JSON-LD present after rendering, but server-rendered markup is safer for crawlers that do not run JavaScript.

Should Organization go on every page?

Google asks for it on the home page or one page about the organization; other pages can reference it as publisher.

Does Cursor or another agent work the same way?

Yes. Any agent that edits your templates can follow the same prompt; only the instructions file name changes.

Continue reading

Last verified on .

Add schema markup (JSON-LD) with Claude Code or Codex