@@ -48,6 +48,9 @@ const projectId = process.env.SANITY_STUDIO_PROJECT_ID || "hfh83o0w";
4848const dataset = process . env . SANITY_STUDIO_DATASET || "production" ;
4949const apiVersion = process . env . SANITY_STUDIO_API_VERSION || "2025-09-30" ;
5050const studioUrl = "/" ;
51+ // Set SANITY_STUDIO_DISABLE_PRESENTATION=true if you get network errors to api.sanity.io (e.g. firewall/VPN)
52+ const presentationEnabled =
53+ process . env . SANITY_STUDIO_DISABLE_PRESENTATION !== "true" ;
5154
5255function resolveHref ( type : string , slug ?: string ) : string | undefined {
5356 switch ( type ) {
@@ -171,45 +174,49 @@ export default defineConfig({
171174 } ,
172175 } ,
173176 plugins : [
174- presentationTool ( {
175- resolve : {
176- mainDocuments : defineDocuments ( [
177- {
178- route : "/post/:slug" ,
179- filter : `_type == "post" && slug.current == $slug` ,
180- } ,
181- ] ) ,
182- locations : {
183- settings : defineLocations ( {
184- locations : [ homeLocation ] ,
185- message : "This document is used on all pages" ,
186- tone : "caution" ,
187- } ) ,
188- post : defineLocations ( {
189- select : {
190- title : "title" ,
191- slug : "slug.current" ,
192- } ,
193- resolve : ( doc ) => ( {
194- locations : [
177+ ...( presentationEnabled
178+ ? [
179+ presentationTool ( {
180+ resolve : {
181+ mainDocuments : defineDocuments ( [
195182 {
196- title : doc ?. title || "Untitled" ,
197- // biome-ignore lint/style/noNonNullAssertion: resolveHref returns string for known types
198- href : resolveHref ( "post" , doc ?. slug ) ! ,
183+ route : "/post/:slug" ,
184+ filter : `_type == "post" && slug.current == $slug` ,
199185 } ,
200- homeLocation ,
201- ] ,
202- } ) ,
186+ ] ) ,
187+ locations : {
188+ settings : defineLocations ( {
189+ locations : [ homeLocation ] ,
190+ message : "This document is used on all pages" ,
191+ tone : "caution" ,
192+ } ) ,
193+ post : defineLocations ( {
194+ select : {
195+ title : "title" ,
196+ slug : "slug.current" ,
197+ } ,
198+ resolve : ( doc ) => ( {
199+ locations : [
200+ {
201+ title : doc ?. title || "Untitled" ,
202+ // biome-ignore lint/style/noNonNullAssertion: resolveHref returns string for known types
203+ href : resolveHref ( "post" , doc ?. slug ) ! ,
204+ } ,
205+ homeLocation ,
206+ ] ,
207+ } ) ,
208+ } ) ,
209+ } ,
210+ } ,
211+ previewUrl : {
212+ previewMode : {
213+ enable : "/api/draft-mode/enable" ,
214+ disable : "/api/draft-mode/disable" ,
215+ } ,
216+ } ,
203217 } ) ,
204- } ,
205- } ,
206- previewUrl : {
207- previewMode : {
208- enable : "/api/draft-mode/enable" ,
209- disable : "/api/draft-mode/disable" ,
210- } ,
211- } ,
212- } ) ,
218+ ]
219+ : [ ] ) ,
213220 structureTool ( { structure : podcastStructure ( ) } ) ,
214221 // Configures the global "new document" button, and document actions, to suit the Settings document singleton
215222 singletonPlugin ( [
0 commit comments