-
Notifications
You must be signed in to change notification settings - Fork 0
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.
| 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 |
POST /schema/generate
x-tenant-id: tenant-a
x-project-id: project-1
content-type: application/jsonArticle 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.
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>import { useSchemaGenerator } from "@rankmyseo/react";
const { result, generating, generate } = useSchemaGenerator();
await generate({
type: "Organization",
name: "RankMySEO",
url: "https://example.com",
});Open the reference dashboard (pnpm dev:dashboard) → Schema generator tab. Pick a type, fill fields, copy JSON-LD or the script tag.
The agent exposes a read-only generateSchema tool (and MCP generate_schema) using the same Zod input schema.
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.
- API Reference → Schema generate
- SEO Playbook — structured data parameters