Understanding and implementing productionURL in Sanity v3 using the sanity-plugin-iframe-pane plugin.
The productionURL you're asking about is typically used in Sanity's preview/presentation features to help the Studio know where your production website is hosted. Let me break down the easiest way to set it up.
Basic Setup
The simplest way to configure your production URL is in your sanity.config.ts when setting up the Presentation tool:
// sanity.config.ts
import {defineConfig} from 'sanity'
import {presentationTool} from 'sanity/presentation'
export default defineConfig({
// ... other config
plugins: [
presentationTool({
previewUrl: 'https://your-website.com', // Your production URL
// Or for local development:
// previewUrl: 'http://localhost:3000',
}),
],
})What It's For
The previewUrl (sometimes called productionURL in guides) tells Sanity Studio:
- Where to load your website preview in the Presentation tool
- How to construct URLs when navigating between documents
- Where to send editors when they click "Open Preview"
Common Patterns
For different environments:
presentationTool({
previewUrl: process.env.SANITY_STUDIO_PREVIEW_URL || 'http://localhost:3000',
})This way you can use environment variables to switch between local and production URLs.
Don't Overthink It
If you're just getting started, simply point it to where your website runs:
- Local development:
http://localhost:3000(or whatever port your dev server uses) - Production: Your actual website URL like
https://mysite.com
The guides you might be reading could be showing more complex setups with document resolvers and location resolvers for advanced routing patterns, but you don't need those to get started. Just set the basic previewUrl and you should be good to go!
If you need more advanced features like automatically opening specific documents to their corresponding pages, that's where the Presentation Resolver API comes in, but start simple first.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.