Skip to main content
seofields
docs

Live SEO Preview

Preview how your title, URL, and description may appear in Google search results while you edit — with real-time character counts and validation.

Preview Example

https://example.com/about

About Our Company — Example Site

Learn about our mission, team, and values. We build products that help businesses grow their online presence through better SEO.

How It Works

The SEO preview is rendered alongside your SEO fields in the document editor. It updates in real time as you type, showing:

URL with customizable prefix based on document data
Title truncated at 60 characters, including any configured title suffix and the plugin-added " | " separator
Description truncated at 160 characters
Character counts with color-coded feedback that stay aligned with the rendered SERP title

Google can rewrite title links and snippets based on query, device, and page content, so this preview is guidance rather than a guarantee.

Configuration

Preview configuration
// Enable preview (disabled by default)
seofields({ seoPreview: true })

// Custom URL prefix using document context
seofields({
  seoPreview: {
    prefix: (doc) => `/${doc.slug?.current || 'page'}`
  },
  baseUrl: 'https://www.example.com',
})

// Static brand suffix on the SERP title — provide only the text, the plugin adds " | " automatically
seofields({
  seoPreview: {
    titleSuffix: 'Acme Inc',
    // By default the suffix uses muted gray (#70757a). Set this to
    // render it in the same blue/weight as the parent title.
    titleSuffixInheritColor: true,
  },
})

// Function-based titleSuffix — derive the suffix from document data
seofields({
  seoPreview: {
    titleSuffix: (doc) => doc?.brandName ?? '',
  },
})

// Dynamic titleSuffix from a GROQ query (takes priority over titleSuffix)
// Uses the root `apiVersion` plugin option for the fetch.
seofields({
  apiVersion: '2024-01-01',
  seoPreview: {
    titleSuffixQuery: `*[_id == "siteSettings"][0].titleSuffix`,
    titleSuffixInheritColor: true,
  },
})
titleSuffix priority: titleSuffixQuery > titleSuffix (function) > titleSuffix (string). The GROQ query is fetched using the root apiVersion plugin option (default '2024-01-01'). The resolved suffix is also used by the Meta Title validation helper, so the feedback message and live preview use the same final title length.

Character Guidelines

FieldOptimalMaxBest Practice
Meta Title50–60 chars70Count the full rendered title, including any configured suffix
Meta Description120–160 chars160Compelling summary with call to action
OG Title40–60 chars70Can differ from meta title for social
X Description100–200 chars200Concise but descriptive for the X feed

Last updated: May 27, 2026. Tested with: Sanity Studio v3, v4, and v5.

Was this page helpful?