# 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; --- {seo?.metaTitle} ``` ### Nuxt 3 ```ts useHead({ title: seo.value?.metaTitle, meta: [ { name: "description", content: seo.value?.metaDescription }, { property: "og:title", content: seo.value?.ogTitle }, ], }); ``` ## bodyFields — reading nested content ```ts seoMetaFields({ bodyFields: [ "body", // simple field "sections[].content", // array of blocks ["sections", "columns", "body"], // Sanity native path array ], }) ``` ## Pages on this site - [Home](https://sanity-seo-plugin.bkpatel.com/): Overview of sanity-plugin-seo - [Features](https://sanity-seo-plugin.bkpatel.com/features): Full feature list - [AI Features](https://sanity-seo-plugin.bkpatel.com/ai-features): AI meta generation and GEO checklist - [Pricing](https://sanity-seo-plugin.bkpatel.com/pricing): Free and Pro plans - [Integrations](https://sanity-seo-plugin.bkpatel.com/integrations): Next.js, Astro, Nuxt, SvelteKit, Remix - [Docs](https://sanity-seo-plugin.bkpatel.com/docs): Full setup guide and API reference - [Contact](https://sanity-seo-plugin.bkpatel.com/contact-us): Contact the team ## FAQ Q: Is sanity-plugin-seo free? A: Yes. The core plugin — including AI generation and GEO checklist — is fully free and open source under the MIT license. Q: Does it work with Sanity v5? A: Yes. It works with Sanity Studio v3, v4, and v5. Q: Do I need an AI API key? A: No. AI features are optional. The plugin works without any AI configuration. Q: Which AI provider is cheapest? A: Groq has a free tier. OpenAI gpt-4o-mini and Anthropic claude-haiku cost $1–5/month at typical usage. Q: Can I use multiple content fields for AI generation? A: Yes. Use bodyFields to list multiple fields including nested array paths. Q: Does it support hreflang for multilingual sites? A: Yes. There is a built-in hreflang section for defining language and region alternates.