Guide · 8 min read
Sanity SEO and AEO: The Fields and Checks Your Studio Needs
Because Sanity is a headless CMS, its SEO and AEO depend on the fields you model. A Studio set up for Google and AI answers needs a reusable seo object (meta title, meta description, share image, noindex), a validated slug, required alt text, a named author with dates, and structured data, sitemap and robots output generated from those fields. Kuartz Studio builds Sanity sites with these checks; see our projects.
What does a Sanity Studio need for SEO?
A Sanity Studio needs fields that map to what search engines read, plus validation that stops weak content from going live. Sanity is a headless CMS, so it stores content and nothing else. Titles, meta tags, sitemaps and schema markup exist only if you model them as fields and your front end renders them.
The pattern we use has three layers. Fields hold the data editors write. Validation rules catch mistakes inside the Studio, where fixing them costs seconds. Generated output, such as structured data and the sitemap, reads from the fields so nobody maintains it by hand. Each layer removes one way for a page to ship broken.
Sanity's validation system supports both levels. A rule that fails is an error by default and blocks publishing. Chain warning() and the rule only advises. Studio validation runs in the browser only, so content written through the API skips it, and your front end should still handle missing values.
Which fields go in the seo object?
The seo object holds the fields every public page shares. Put it in one reusable object type and add it to each page type, so a rule changes once. The table below lists the fields, their types, the reason each exists and the check that belongs on it.
| Field | Type | Why | Check |
|---|---|---|---|
| Meta title | string | Becomes the title link in Google results | Required; 300 to 600 px wide; unique across the site |
| Meta description | text | Often used as the snippet | Required; 720 to 960 px wide; unique |
| Share image | image with alt | Preview on social and chat apps | Required on posts; alt text required |
| Noindex | boolean | Keeps a page out of the index | Warn when set on a page in the sitemap |
| Canonical URL | url, optional | Points duplicates at the main page | Must be absolute; empty means self |
| Focus search | string | The search the page targets | One per page; warn on duplicates |
The pixel ranges are the working ranges Pulse uses (see below), not a Google rule. Google says title links are truncated "to fit the device width" and gives no character limit. Snippets follow the same rule. Pixel width tracks what a searcher sees better than a character count, because an "i" is narrower than a "W".
Google may also rewrite a title link or choose a snippet from the page body, so these fields are a strong hint, not a command. Still, a unique, descriptive title and a page-specific description are the two fields Google's guidance stresses. Keep the main words at the start of both.
What are the rules for slugs?
A slug should be lowercase, short, descriptive and unique within its document type. Sanity's slug type generates a slug from a source field and lets you set maxLength, a custom slugify function and an isUnique check. By default it checks uniqueness among documents of the same type that hold the slug at the same field path.
Add required() so no page publishes without a URL. Make the slug read-only after the first publish, or warn on any edit, because a changed URL needs a redirect. Google's starter guide favors URLs with words that describe the page over random identifiers.
Three slug rules cover most mistakes:
- Generate from the title, then edit. Editors get a clean start and can shorten it.
- Cap the length. The
maxLengthoption defaults to 200 characters, so set a lower limit to keep URLs readable. It is ignored when you supply your ownslugifyfunction. - Block changes after publishing. If a change is needed, require a redirect entry first.
How do you enforce alt text in the Studio?
Alt text lives in a custom field on the image, and you enforce it with a validation rule. Sanity's image type lets you add a string alt field inside the image's fields array. Chain required() on that field and the Studio refuses to publish an image without a description.
The docs do not enforce alt text for you, so this rule is your job. Apply it to every image: cover images, share images and images inside Portable Text. Google's starter guide calls alt text "short, but descriptive" and says it should explain how the image relates to your content.
Add a warning when alt text matches the file name or runs very long. Neither is an error, but both usually signal a rushed entry. For decorative images, add an explicit "decorative" toggle, so empty alt text is a choice and not an omission.
How do author and dates support SEO and AI answers?
An article needs a named author with a short bio, a published date and an honest modified date. Readers use them to judge trust, and structured data carries them to search engines. Google's Article structured data recommends author, datePublished and dateModified in ISO 8601 format with a time zone.
Model the author as a separate document with a name, a profile URL and a bio, then reference it from each post. Require the reference on publish. A reference keeps the name and URL consistent across posts, which helps both readers and machines tie the pieces to one person.
Keep dateModified honest. Fill it only when the content changed in a way a reader would notice, and show the same date on the page. Updating it for a typo fix teaches nobody anything. A check that compares the visible date with the last real edit catches the common drift.
How should structured data, the sitemap and robots.txt be generated?
Generate all three from content fields, and never write them by hand. Structured data should be built at render time from the same fields the page displays. Google says JSON-LD is in most cases the easiest format to maintain, and it asks that markup describe content visible on the page, so a generator that reads the visible fields stays honest.
The sitemap should list every indexable page and skip any page marked noindex. Build it from a content query at deploy time. The robots file should come from the same source: a block for any section you hide, and a link to the sitemap. Our own site generates both from Sanity content on each build.
Keep one distinction clear. Google's robots.txt guide says a URL blocked in robots.txt can still appear in results, and that noindex or a password is the way to keep a page out. So the noindex field in your seo object, not a robots entry, is the control for hiding a page from search.
How do you handle redirects when a slug changes?
Keep a redirect list in Sanity and have your front end or host apply it. Sanity's SEO guide covers redirects as part of the same job as slugs and sitemaps. Model a small document with a source path, a destination path and a type, and validate that the destination exists.
Use a permanent redirect for a moved page. Google's redirect documentation names the 301 and 308 status codes as the permanent ones. Check the redirect list when you rename a slug, so no page loses its old address.
How do you write a page so an AI assistant can quote it?
Lead with the answer. The first paragraph should state the answer in 40 to 80 words, reuse the words of the title and avoid a question or a preamble. Assistants lift short passages, so each paragraph should make sense alone. Our post on getting cited by ChatGPT and Perplexity covers the practices behind this, and our study of 4 AI assistants shows which agencies they name.
Structure carries as much weight as wording. Use one H1, then H2 sections that read as the questions buyers ask, with the answer in the first sentence. Never skip a heading level. Add real numbers, name the tools and products involved, and link to two or three authoritative sources, so a reader can verify each claim.
Match lists and tables to the content. A comparison belongs in a table, and a sequence belongs in a numbered list. In Portable Text, tables come from Sanity's @portabletext/plugin-table, which the editor configuration docs say is off by default and needs Studio 6.6.0 or later. Declare the headerRows field, or the header setting does nothing.
Internal links need descriptive anchor text. Define a link annotation that references other documents, so a renamed slug does not leave a broken link. Our explainer on GEO, AEO and SEO shows how the three goals differ and where they overlap.
How does Pulse check these inside the Studio?
Pulse is the SEO and AI-search plugin we install in clients' Sanity Studios, currently in beta. It reads the real document and scores each page twice: once for Google and once for AI answers. It works from the fields above, so a project that models them well gets useful checks with no extra setup.
The SEO score runs checks such as a unique title between 300 and 600 px (Pulse's own range), a meta description between 720 and 960 px, a slug, alt text on the main image and the images in the text, a named author with a bio, and a visible date that matches the last real update. A check can block publishing, such as missing alt text on an image in the text.
The AI score has seven parts. Three carry points: the direct answer (40 points), the structure (30) and the names of real things (30). Four are advice only: facts and numbers, sources cited, tables and lists, and "ready to quote," which checks for paragraphs of 25 to 90 words. The score measures clear writing, not a promise of being cited.
Pulse proposes and a human decides. It can write a draft into a Sanity draft after an explicit confirmation, and it never publishes. For a wider view of which fields to pair with which checks, our guide to choosing a headless CMS for a SaaS site compares how Sanity handles this against other options, and Sanity vs Contentful covers the closest rival.
FAQ
Do I need a plugin to do SEO in Sanity?
No. A plain seo object, validation rules and a front end that renders the fields cover the basics. Community plugins add ready-made fields and scoring. As of November 2026, sanity-plugin-seo on npm supports Studio v3, v4 and v5 and counted 4,411 downloads in the week to November 6. Check any plugin's page before you adopt it.
How long should a meta description be?
Google sets no character limit and truncates by device width. Aim for roughly 720 to 960 px, the range Pulse checks, and put the key information first.
Should alt text be required in the Studio?
Yes. Make the alt field required on every image, with an explicit decorative option for the rare exception. A required field catches the omission at the moment a fix costs seconds.
Is structured data needed for AI answers?
Google's page on AI features and your website says there are no additional requirements to appear in AI Overviews or AI Mode: no special markup or file, only a page that is indexed and eligible for a snippet. Structured data still helps classic search, and Google requires it to match what the page shows.
Sources
- Slug type, Sanity Docs
- Validation, Sanity Docs
- Image type, Sanity Docs
- Portable Text editor configuration, Sanity Docs
- Influence your title links in search results, Google Search Central
- Control your snippets in search results, Google Search Central
- Introduction to structured data, Google Search Central
- Article structured data, Google Search Central
- SEO Starter Guide, Google Search Central
- Introduction to robots.txt, Google Search Central
- Redirects and Google Search, Google Search Central
- AI features and your website, Google Search Central
- The Ultimate Guide to SEO with Sanity, Sanity
- sanity-plugin-seo, npm