> Version: 1.9.0 | Updated: July 2026 # sanity-plugin-seofields > Comprehensive SEO management plugin for Sanity Studio v3/v4/v5 — meta tags, Open Graph, Twitter/X Cards, robots directives, live SERP preview, Schema.org structured data, and a 100-point SEO Health Dashboard. sanity-plugin-seofields is an open-source npm package authored by Hardik Desai (https://thehardik.in). It adds a single `seoFields` object field to any Sanity document schema and provides a complete SEO toolkit with zero configuration required. The plugin is free to use (MIT licensed) for all core features. Paid features require a one-time license key tied to the Sanity project ID. ## Key Features - Meta tags: title (≤60 chars), description (≤160 chars), keywords, canonical URL - Open Graph: ogTitle, ogDescription, ogImage (Sanity asset), ogType - Twitter/X Cards: summary and summary_large_image card types - Robots directives: noindex, nofollow, noarchive, nosnippet per document - Live SERP preview: real-time Google search result simulation as editors type - Meta Tags Preview: live HTML `` output panel inside Studio (no publish-view-source cycle) - Focus Keyword: track the primary target keyword; drives GEO checklist prominence checks - GEO Checklist: AI Overview / Generative Engine Optimization readiness checks inside Studio - Hreflang: BCP 47 alternate link management for multilingual and multi-regional SEO - Schema.org: 39 structured-data types with contextual fields and live JSON-LD preview - AI Content Generation: "Generate with AI" button for title, description, focus keyword, keywords, Open Graph, and X Card fields — 5 providers (OpenAI, Anthropic, Groq, Gemini, Ollama), 17 industries (8 free, 9 pro) with up to 10 prompt variations per field, and secure server-side proxy adapters (sanity-plugin-seofields/server) for Next.js, Express, Node, and Fetch API runtimes - SEO Health Dashboard: 0–100 scoring across all documents (including graded keyword/focus-keyword placement scoring, not just presence), CSV/JSON export, CI CLI - Publish Gate (pro): block or warn before publishing if SEO score is below a threshold ## Documentation - [Home](https://sanity-plugin-seofields.thehardik.in/): Overview and quick-start - [Installation](https://sanity-plugin-seofields.thehardik.in/docs/installation): npm / yarn / pnpm install instructions - [Quick Start](https://sanity-plugin-seofields.thehardik.in/docs/quick-start): Zero-config setup in 3 steps - [Configuration](https://sanity-plugin-seofields.thehardik.in/docs/configuration): Plugin options reference - [Schema Types](https://sanity-plugin-seofields.thehardik.in/docs/schema-types): seoFields, openGraph, twitter, robots, metaTag, metaAttribute - [Field Groups](https://sanity-plugin-seofields.thehardik.in/docs/field-groups): Organize SEO fields into tabbed groups inside Studio - [Field Visibility](https://sanity-plugin-seofields.thehardik.in/docs/field-visibility): Show/hide field groups per document type - [SEO Preview](https://sanity-plugin-seofields.thehardik.in/docs/seo-preview): Live SERP and social card preview - [Meta Tags Preview](https://sanity-plugin-seofields.thehardik.in/docs/meta-tags-preview): Live HTML meta tags output panel inside Studio - [Focus Keyword](https://sanity-plugin-seofields.thehardik.in/docs/focus-keyword): Primary keyword tracking with title/description prominence analysis - [GEO Checklist](https://sanity-plugin-seofields.thehardik.in/docs/geo-checklist): AI Overview and Generative Engine Optimization readiness checks - [Hreflang](https://sanity-plugin-seofields.thehardik.in/docs/hreflang): BCP 47 alternate link management for multilingual SEO - [AI Integration](https://sanity-plugin-seofields.thehardik.in/docs/ai): Providers, server-side proxy adapters, industries and prompt tiers, content source mapping, refinement pipeline - [Public vs Pro](https://sanity-plugin-seofields.thehardik.in/docs/public-vs-pro): Free vs licensed feature comparison - [SEO Validation](https://sanity-plugin-seofields.thehardik.in/docs/seo-validation): Built-in validation rules - [Frontend Integration](https://sanity-plugin-seofields.thehardik.in/docs/frontend-integration): GROQ queries plus Next.js, Astro, Nuxt, Vue, SvelteKit, Remix, and custom head-rendering examples - [SEO Health Dashboard](https://sanity-plugin-seofields.thehardik.in/docs/dashboard): Studio-wide 0–100 health scoring - [Dashboard Setup](https://sanity-plugin-seofields.thehardik.in/docs/dashboard/setup): License key activation - [Dashboard Scoring](https://sanity-plugin-seofields.thehardik.in/docs/dashboard/scoring): Scoring algorithm breakdown - [Schema.org Overview](https://sanity-plugin-seofields.thehardik.in/docs/schema-org): Supported structured-data types - [API Reference](https://sanity-plugin-seofields.thehardik.in/docs/api): Full TypeScript API - [Changelog](https://sanity-plugin-seofields.thehardik.in/docs/changelog): Version history - [CLI](https://sanity-plugin-seofields.thehardik.in/docs/cli): validate and audit commands - [FAQ](https://sanity-plugin-seofields.thehardik.in/faq): Common questions answered - [Get License](https://sanity-plugin-seofields.thehardik.in/get-license): License key for Health Dashboard and pro features ## Schema.org Types Supported Article, BlogPosting, WebPage, WebSite, Product, FAQPage, HowTo, Event, Person, Organization, LocalBusiness, BreadcrumbList, Review, AggregateRating, VideoObject, ImageObject, SoftwareApplication, WebApplication, Course, Brand, ContactPoint, PostalAddress, Place, Offer, Book, Country, ItemList, JobPosting, LegalService, Movie, MusicAlbum, MusicRecording, NewsArticle, OpinionNewsArticle, ProfilePage, Recipe, Restaurant, Service, SocialMediaPosting ## AI Content Generation sanity-plugin-seofields can generate and refine SEO copy directly inside Sanity Studio via a "Generate with AI" button. Configured through the `ai` object in plugin config. Generated fields: title, description, focusKeyword, keywords, ogTitle, ogDescription, twitterTitle, twitterDescription. Providers: openai (default), anthropic, groq, gemini, ollama (no key required, local models), or any OpenAI-compatible `baseUrl` (DeepSeek, xAI Grok, Azure OpenAI, self-hosted). API key security: Sanity Studio is a client-side app — `apiKey` set directly is bundled into browser JS and readable by anyone with Studio access, regardless of env-var naming. For production, use `endpoint` with a server-side proxy adapter instead. The plugin logs a console warning if `apiKey` is set without `endpoint`. Server-side proxy adapters (`sanity-plugin-seofields/server`): `createNextRouteHandler`, `createExpressHandler`, `createNodeHandler`, `createFetchHandler` (any Fetch API runtime — Cloudflare Workers, Deno, Bun). Each wraps the same generation + refinement pipeline as direct-provider mode, keeping the real API key server-side only. Industries and prompt tiers (17 total, 10 prompt variations per field): - Free (8): blog, restaurant, travel, ecommerce, education, fitness, hospitality, nonprofit — 4 of 10 prompts free per field, remaining 6 unlock with a license - Pro (9): healthcare, pharmacy, finance, realestate, saas, legal, insurance, automotive, homeServices — all 10 prompts require a license - Without `industry` set, generation uses generic prompts, always free Content source (`ai.content`): defaults to the document's `body` field. Accepts a single field name, an array of fields in priority order, or a per-document-type mapping (`Record` with a `default` key for unlisted types). Nested Portable Text is found automatically. Generation and refinement pipeline: each attempt is checked for (1) length against the field's target character range, (2) required keyword presence — injected if missing, (3) readability — simplified if too complex, (4) focus-keyword verbatim match against existing title/description. Retries via `maxRetries` (default 2); `keepFirstOnValidationFail` controls whether the first or last attempt is returned if every retry still fails validation. Other config options: `buttonWidth` ('full' default, stretches the button, or 'auto', left-aligned normal width), `temperature` (default 0.7), `model` (override provider default), `testMode` (static demo outputs, no API call). Full reference: https://sanity-plugin-seofields.thehardik.in/docs/ai ## Installation ``` npm install sanity-plugin-seofields ``` ```typescript import { defineConfig } from 'sanity' import seofields from 'sanity-plugin-seofields' export default defineConfig({ plugins: [seofields()], // zero-config }) ``` ## Links - npm: https://www.npmjs.com/package/sanity-plugin-seofields - GitHub: https://github.com/hardik-143/sanity-plugin-seofields - Sanity Marketplace: https://www.sanity.io/plugins/sanity-plugin-seofields - Author: https://thehardik.in - Demo: https://sanity-plugin-seofields.thehardik.in/demo/health-dashboard - FAQ: https://sanity-plugin-seofields.thehardik.in/faq