Skip to content

Conversation

@Jannih
Copy link

@Jannih Jannih commented Dec 12, 2025

Description

Closes #5443

Adds per-page JSON-LD structured data (Schema Markup) configuration in Page Settings with AI-powered generation.

Features:

  • New "Schema Markup" section in Page Settings
  • AI-powered schema generation using OpenAI GPT-5.1 with 18 schema.org types (Organization, Product, FAQ, Article, etc.)
  • JSON editor with syntax highlighting and validation
  • Duplicate singleton schema type warnings (e.g., warns if multiple Organization schemas on same page)
  • Renders JSON-LD scripts in published pages via <script type="application/ld+json">

Technical:

  • New schemaMarkup field in page meta schema
  • SchemaMarkup component for builder UI
  • PageSettingsSchemaMarkup component for runtime rendering
  • AI router with TRPC integration (requires OPENAI_KEY env variable)

Steps for reproduction

  1. Open Page Settings for any page
  2. Scroll to "Schema Markup" section
  3. Click "Generate with AI" and select a schema type (e.g., Organization)
  4. Verify JSON-LD is generated with page context (title, URL, etc.)
  5. Alternatively click "Add manually" to add empty template
  6. Publish the page
  7. Inspect the published page source - JSON-LD should appear in <head>

Code Review

  • hi @kof, I need you to do
    • conceptual review (architecture, feature-correctness)
    • detailed review (read every line)
    • test it on preview

Before requesting a review

  • made a self-review
  • added inline comments where things may be not obvious (the "why", not "what")

Before merging

  • tested locally and on preview environment (preview dev login: 0000)
  • updated test cases document
  • added tests
  • if any new env variables are added, added them to .env file
    • OPENAI_KEY - Required for AI schema generation
    • OPENAI_ORG - Optional OpenAI organization ID

ai generated schema markup
fix type check
Copy link
Member

@kof kof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow just saw what you did here 😅

Problem is we haven't built the new AI integration yet and there needs to be:

  1. defined which provider we want to use, probably vercel gateway to have access to many models
  2. how payments are going to work, we can't just connect latest model for free for users, only a cheap model would be possible, not big latest LLM, otherwise it will potentially cost more than we get from users.
  3. Billing that we have implemented for inception along with a new login needs to be used for paying AI credits.

These are the thoughts so far. Please next time discuss in detail with us the feature to avoid building something we can't really merge yet.

@kof
Copy link
Member

kof commented Dec 16, 2025

MAybe for starters we could merge JSONLD editing without AI and put AI on the next step for this?

value: schemaMarkup,
});
}}
pageContext={{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, you are not providing the entire page content, what am I missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kof !
Yes, i intentionally did not send the entire page content. The same reason you mentioned, the model costs, but if we go with a cheap model we should definitely include the page content for better results, even if the cost concern is actually minimal since schema generation is typically a one-time action per page, not continuous usage.

But regarding the AI integration: Yes, makes sense to merge JSON-LD editing without AI first. I can adapt the PR to remove the AI generation feature and keep just the manual schema editing capability.

Should I update the PR to remove the AI parts?

@iocouto
Copy link

iocouto commented Dec 19, 2025

In order to decide which schema to use, and then populate it with the appropriate data from the page, the AI needs to have access to schema.org specs, and the page data. There are indeed FREE AI models that could handle this and do the entire structured data generation — eg., there are some fee models available through OpenRouter which we use for testing, and they have performed successfully for us in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate schema markup with AI

3 participants