Skip to content

Schema Generator

github-actions[bot] edited this page Jun 26, 2026 · 1 revision

Schema Generator

Generate Schema.org JSON-LD for rich search results. RankMySEO ships typed builders for five essential schema types, exposed via the core engine, HTTP API, React hook, dashboard UI, and AI agent.

Supported types

Type Use case
Article Blog posts, guides, news
Product E-commerce product pages
FAQPage FAQ sections (FAQ rich results)
BreadcrumbList Site navigation breadcrumbs
Organization Brand/company entity

HTTP API

POST /schema/generate
x-tenant-id: tenant-a
x-project-id: project-1
content-type: application/json

Article example:

{
  "type": "Article",
  "headline": "How to choose SEO tools",
  "description": "A practical comparison for small teams.",
  "url": "https://example.com/seo-tools",
  "authorName": "Jane Doe",
  "publisherName": "Example Co"
}

FAQPage example:

{
  "type": "FAQPage",
  "questions": [
    { "question": "What is RankMySEO?", "answer": "An open-source SEO toolkit." }
  ]
}

Response:

{
  "data": {
    "schema": {
      "type": "FAQPage",
      "jsonLd": { "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [] },
      "html": "<script type=\"application/ld+json\">…</script>"
    }
  }
}

Invalid input returns 400 with Zod validation details.

Core API

import { generateSchema, schemaGeneratorInputSchema } from "@rankmyseo/core";

const schema = generateSchema({
  type: "BreadcrumbList",
  items: [
    { name: "Home", url: "https://example.com" },
    { name: "Blog", url: "https://example.com/blog" },
  ],
});

console.log(schema.html); // paste into <head>

React hook

import { useSchemaGenerator } from "@rankmyseo/react";

const { result, generating, generate } = useSchemaGenerator();

await generate({
  type: "Organization",
  name: "RankMySEO",
  url: "https://example.com",
});

Dashboard

Open the reference dashboard (pnpm dev:dashboard) → Schema generator tab. Pick a type, fill fields, copy JSON-LD or the script tag.

AI agent

The agent exposes a read-only generateSchema tool (and MCP generate_schema) using the same Zod input schema.

Audit integration

Live scans (POST /scan) now extract @type values from existing JSON-LD blocks into signals.jsonLdTypes. The json-ld audit check reports detected types (e.g. "JSON-LD present: Article, BreadcrumbList") without changing pass/fail scoring.

Related

Clone this wiki locally