Skip to main content
seofields
docs

Focus Keyword

The focusKeyword field lets editors record the primary keyword they are targeting for a page. It is visible inside the seoFields object and feeds directly into the GEO Checklist for keyword presence checks.

What it does

The focus keyword is stored as a plain string on the seoFields object. The plugin reads it inside the GEO Checklist to check whether the keyword appears in the meta title and description, helping editors keep on-page optimisation consistent. It does not affect the generated <meta> tags — it is an editorial aid only.

Enabling

The focusKeyword field is part of the seoFields schema and is shown by default. No extra config is required — it appears as soon as you add seofields() to your plugins array.

sanity.config.ts
import seofields from 'sanity-plugin-seofields'
import { defineConfig } from 'sanity'

export default defineConfig({
  // ...
  plugins: [
    seofields(),   // focusKeyword is included automatically
  ],
})

Hiding the field

Use defaultHiddenFields or per-type fieldVisibility to hide it globally or on specific document types:

sanity.config.ts
seofields({
  // Hide globally
  defaultHiddenFields: ['focusKeyword'],

  // — or — hide per document type
  fieldVisibility: {
    internalPage: { hiddenFields: ['focusKeyword'] },
  },
})

Using with Field Groups

When you configure field groups, include focusKeyword in the group where it makes most sense — typically the main Meta tab:

sanity.config.ts
seofields({
  fieldGroups: [
    {
      name: 'meta',
      title: 'Meta',
      default: true,
      fields: [
        'title',
        'description',
        'focusKeyword',   // ← add here
        'metaImage',
        'keywords',
        'canonicalUrl',
        'robots',
      ],
    },
    { name: 'openGraph', title: 'Open Graph', fields: ['openGraph'] },
    { name: 'twitter',   title: 'Twitter Card', fields: ['twitter'] },
    { name: 'geo',       title: 'GEO / AI',     fields: ['geoChecklist'] },
  ],
})

GROQ Query

Fetch focusKeyword alongside other SEO fields:

GROQ query
*[_type == "post" && slug.current == $slug][0]{
  title,
  seo {
    title,
    description,
    focusKeyword,
    canonicalUrl,
    robots { noIndex, noFollow },
    openGraph { title, description },
  }
}

TypeScript

The SeoFields type exported by the plugin includes focusKeyword:

TypeScript usage
import type { SeoFields } from 'sanity-plugin-seofields'

// focusKeyword is an optional string on SeoFields
const keyword: string | undefined = document.seo?.focusKeyword

Tip: The GEO Checklist checks whether the focus keyword appears in both the meta title and meta description. Fill it in to get accurate GEO readiness scores.

Was this page helpful?