Sanity Pioneers: Get early access to betas, extra AI credits, and a direct line to the engineering team. Apply now

PageBridge

Recover traffic from your best content. PageBridge syncs Google Search Console data into Sanity Studio so you detect decay and fix it without leaving your editor.

By Soma Somorjai

Install command

npm i @pagebridge/sanity

PageBridge

PageBridge

Don't just publish content. Keep it.

PageBridge syncs Google Search Console data into Sanity Studio — so you can detect content decay, track keyword performance, and take action without leaving your editor.

MIT License npm Docs


How It Works

Google Search ConsolePageBridge CLIPostgreSQLSanity Studio
                         (nightly sync)    (metrics)    (insights)

Install — Add the plugin to your Sanity Studio. One dependency, zero lock-in.

Connect — Authenticate with Google Search Console. PageBridge syncs your data to Postgres nightly.

Act — Open any document in Sanity. See live performance data, decay warnings, and keyword gaps in the sidebar.

Features

  • Inline Performance Data — See clicks, impressions, CTR, and position right inside the Sanity document sidebar while you edit.
  • Content Decay Detection — Automatic alerts when a page drops in rankings. Catch the slide before traffic disappears.
  • Landing Page Intelligence — Works on modular page-builder schemas, not just blog posts. See which keywords drive leads to specific landing pages.
  • Striking Distance Queue — Surfaces pages ranking between Position 4–10 with high impressions. These are your quick wins.
  • Refresh Tasks — Generates actionable tasks in Sanity Studio for pages that need attention.
  • URL Diagnostics — Detailed diagnostics for unmatched URLs so you can debug slug mismatches instantly.

Quick Start

1. Install packages

pnpm add @pagebridge/sanity
pnpm add -D @pagebridge/cli

2. Add the plugin to Sanity Studio

// sanity.config.ts
import { defineConfig } from "sanity";
import { pageBridgePlugin } from "@pagebridge/sanity";

export default defineConfig({
  // ...
  plugins: [pageBridgePlugin()],
});

3. Configure environment variables

Create a .env.local (or .env) file. PageBridge uses a PAGEBRIDGE_ prefix to avoid conflicts with your existing env vars:

# Google Service Account JSON (stringified)
PAGEBRIDGE_GOOGLE_SERVICE_ACCOUNT='{"type":"service_account",...}'

# PostgreSQL connection string
PAGEBRIDGE_DATABASE_URL='postgresql://postgres:postgres@localhost:5432/pagebridge'

# Sanity Studio configuration
PAGEBRIDGE_SANITY_PROJECT_ID='your-project-id'
PAGEBRIDGE_SANITY_DATASET='production'
PAGEBRIDGE_SANITY_TOKEN='sk...'

# Your website base URL
PAGEBRIDGE_SITE_URL='https://your-site.com'

4. Set up the database

# Start PostgreSQL (or use an existing instance)
docker run -d --name pagebridge-db \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=pagebridge \
  -p 5432:5432 \
  postgres:16

5. Run your first sync

pnpm pagebridge sync --site sc-domain:your-site.com --migrate

That's it. Open Sanity Studio — you'll see performance data in the sidebar and a Refresh Queue tool for decaying content.

For the full setup guide, see pagebridge.io/docs/quick-start.

Packages

This is a Turborepo monorepo. All packages are 100% TypeScript.

PackageDescriptionnpm
@pagebridge/sanitySanity Studio v3 plugin — schemas, performance pane, refresh queuenpm
@pagebridge/cliCLI for syncing GSC data, running diagnostics, and managing setupnpm
@pagebridge/coreSync engine, decay detection, URL matching, task generationnpm
@pagebridge/dbDrizzle ORM schema and PostgreSQL clientnpm

CLI Commands

pagebridge init                  # Interactive setup wizard
pagebridge doctor                # Diagnose configuration issues
pagebridge sync --site <url>     # Sync GSC data and detect decay
pagebridge list-sites            # List accessible GSC properties
pagebridge diagnose              # Debug unmatched URLs

See the CLI README for full command reference.

Content Decay Detection

PageBridge watches for three decay signals:

SignalTriggerWindow
Position decayPosition drops 3+ spots28 days
Low CTRCTR < 1% for pages in top 10Current
Impressions drop50%+ drop in impressions28 days

Recently published content (default: 45 days) is automatically excluded to avoid false positives.

Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Development mode
pnpm dev

# Lint and type check
pnpm lint
pnpm check-types

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT