# sanity-plugin-seo — Full Reference > sanity-plugin-seo is a free, open-source Sanity Studio plugin that gives editors a full SEO panel inside Sanity CMS. It covers live keyword scoring, AI meta generation, social previews, structured data, hreflang, and GEO analytics for AI search engines. ## Overview - Package: [sanity-plugin-seo](https://www.npmjs.com/package/sanity-plugin-seo) - [GitHub repository](https://github.com/bhargav-bkpatel/sanity-plugin-seo) - [Website](https://sanity-seo-plugin.bkpatel.com) - License: MIT - Downloads: 22,000+ - Sanity compatibility: v3, v4, v5 - Author: Bhargav Patel ## Installation ```bash npm install sanity-plugin-seo ``` ## Basic setup ```ts // sanity.config.ts import { seoMetaFields } from "sanity-plugin-seo"; export default defineConfig({ plugins: [ seoMetaFields({ slugField: "slug", bodyField: "body", }), ], }); ``` ## AI setup ```ts seoMetaFields({ aiFeature: { provider: "openai", // "openai" | "anthropic" | "groq" apiKey: process.env.SANITY_STUDIO_OPENAI_KEY, model: "gpt-4o-mini", }, bodyFields: ["body", "sections[].content"], slugField: "slug", }) ``` ## Feature list ### Free features (available now) - Meta title field with character counter and SEO length indicator - Meta description field with character counter - Focus keyword input with keyword density scoring - Live SEO score (0–100) shown as a ring — updates on every keystroke - Open Graph title, description, and image upload - Twitter Card title, description, and image upload - Social preview card (shows how the page looks when shared) - Schema.org JSON-LD structured data panel - Hreflang tag management for multilingual / multi-region sites - robots meta field (index/noindex, follow/nofollow) - Canonical URL field - AI meta generation — one-click titles, descriptions, and keyword suggestions - GEO checklist — 5-point AI search readiness score - bodyFields — read from multiple content fields including nested arrays ### AI providers supported - OpenAI (gpt-4o-mini) — ~$2–5/month - Anthropic (claude-haiku-4-5) — ~$1–3/month - Groq (llama-3.3-70b-versatile) — free tier available ### GEO (Generative Engine Optimization) checklist 1. Structured data configured (auto — plugin handles this) 2. Description is answer-ready: 100–160 characters 3. OG image present 4. Focus keyword appears in both title and description 5. Open Graph fully configured (title + description + image) Score: 0–5. Green (5/5) = ready for AI crawlers. Amber (3–4) = almost. Red (0–2) = needs work. ## Framework integrations ### Next.js (App Router) ```ts // app/[slug]/page.tsx export async function generateMetadata({ params }) { const post = await client.fetch(query, { slug: params.slug }); return { title: post.seo?.metaTitle, description: post.seo?.metaDescription, keywords: post.seo?.focusKeyword, openGraph: { title: post.seo?.ogTitle, description: post.seo?.ogDescription, images: [post.seo?.ogImage?.asset?.url], }, }; } ``` ### Astro ```astro --- const { seo } = Astro.props; ---