Sanity Plugin Setup
The @pagebridge/sanity adds search performance data, schemas, and tools to your Sanity Studio v3.
Installation
pnpm add @pagebridge/sanityBasic configuration
Add the plugin to your sanity.config.ts:
sanity.config.ts
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'
import {
gscPlugin,
createPageBridgeStructure,
createGscStructureResolver,
PAGEBRIDGE_TYPES
} from '@pagebridge/sanity'
export default defineConfig({
name: 'default',
title: 'My Studio',
projectId: 'your-project-id',
dataset: 'production',
plugins: [
gscPlugin({
contentTypes: ['post', 'page', 'article']
}),
structureTool({
structure: (S) =>
S.list()
.title('Content')
.items([
createPageBridgeStructure(S),
S.divider(),
...S.documentTypeListItems().filter(
(item) => !PAGEBRIDGE_TYPES.includes(item.getId() as string)
)
]),
defaultDocumentNode: createGscStructureResolver(['post', 'page', 'article'])
})
]
})Plugin options
| Option | Type | Description |
|---|---|---|
contentTypes | string[] | Sanity document types that PageBridge can link to. Used by gscSnapshot and gscRefreshTask reference fields. |
What the plugin adds
Schemas
Three document types are registered:
- gscSite — Configuration for each Google Search Console property (site URL, content types, slug field, path prefix)
- gscSnapshot — Performance snapshots with metrics, weekly breakdowns, and top queries per page
- gscRefreshTask — Actionable tasks for content that shows decay signals
Tools
A Refresh Queue tool is added to the Studio toolbar, giving editors a centralized view of all pages needing attention.
Document views
The createGscStructureResolver adds a Performance view tab to every document type you specify in contentTypes.
Exports reference
// Plugin factory
import { gscPlugin } from '@pagebridge/sanity'
// Structure helpers
import {
createPageBridgeStructure,
createGscStructureResolver,
PAGEBRIDGE_TYPES
} from '@pagebridge/sanity'
// Schema factories (for advanced customization)
import {
createGscSnapshot,
createGscRefreshTask
} from '@pagebridge/sanity'
// React components (for custom views)
import {
SearchPerformancePane,
RefreshQueueTool
} from '@pagebridge/sanity'