How to update "Open Sanity Studio" URL for embedded Next.js studio

12 replies
Last updated: Oct 3, 2023
What’s the proper way to update the URL that “Open Sanity Studio” points to? I no longer use the sanity.studio URL as I have embedded the studio into my Next.js app.
AI Update

To update the URL that the "Open Sanity Studio" button points to, you need to configure the canonical studio URL in your project management settings. Here's how to do it:

Update Your Studio URL in Sanity Manage

  1. Navigate to manage.sanity.io and select your project
  2. Go to the Studios tab
  3. Add or update your studio URL to point to your embedded Next.js app (e.g., https://yourdomain.com/admin or wherever your studio is embedded)

This is the canonical studio URL that Sanity uses for the "Open Sanity Studio" button throughout the platform, including in the Dashboard and project management interface.

Additional Setup for Embedded Studios

Since you've embedded the studio in your Next.js app, you'll also need to make sure your studio is properly configured to work with the Dashboard:

1. Generate and deploy your schema:

npx sanity manifest extract --path public/studio/static
npx sanity schema deploy

The --path should correspond to where your studio lives relative to your Next.js project root.

2. Add the Dashboard bridge script to your studio route:

import {preloadModule} from 'react-dom'

const bridgeScript = 'https://core.sanity-cdn.com/bridge.js'

export default function StudioLayout({
  children,
}: {
  children: React.ReactNode
}) {
  preloadModule(bridgeScript, {as: 'script'})
  return (
    <>
      <script src={bridgeScript} async type="module" />
      {children}
    </>
  )
}

This bridge script allows the Dashboard to properly interact with your embedded studio.

3. Ensure your studio is publicly accessible without authentication so Dashboard can embed it properly.

Once you've set the studio URL in manage.sanity.io and deployed these changes, the "Open Sanity Studio" button will point to your custom embedded studio URL instead of the default sanity.studio domain.

For more details, check out the Dashboard configuration documentation.

Show original thread
12 replies
That button currently only works for Studios hosted on Sanity. I know Manage is currently in the process of getting a facelift, so I’ll see if there are any plans to change this.
I just verified that being not true. it opens into my vercel app.
go to settings-&gt;general-&gt; custom studio url
this sets that button
Nice. I love it when I’m wrong and things actually work as intended.
Ah ok so how to I remove the old URL? I want to delete the repo and cleanup so I’m being a good citizen 😅
edit it and remove it. save. it just disappears.
Oh I mean the sanity.studio URL that was originally created when I first started
I dont follow.
So I can still physically go to my sanity.studio URL that was created when I originally started with Sanity. But now that I’ve moved to it being on my website’s domain I want to just clean all that up.
sanity undeploy
ohh you mean the hosted application

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.

Was this answer helpful?