Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

Adding a script to the header of the sanity studio, but I can't find where i can make additions to the <head> element.

3 replies
Last updated: Nov 13, 2020

Hi out there! I am trying to add a script to the header of the sanity studio, but i can’t seem to find where i can make additions to the &lt;head&gt; element. Can anyone point me in the right direction!

Nov 12, 2020, 8:43 AM

You can override Document.js ( ).

  "implements": "part:@sanity/base/document",
  "path": "components/Document.js"
You need to compile the jsx yourself if you override this thing. I've used parcel to do this, but you can use webpack or rollup as well.

parcel build src/Document.js --out-dir lib/
If you do this you get cut off from any future updates to Document.js though, so you should be careful. You could avoid this by using something that's present on all pages, and overwrite that, instead of the complete document. I've found that overriding the logo (
sanity init plugin -&gt; Studio logo
) is the easiest way to load something on every page - so you might be better off using something like that. But that may be the hacker in me speaking.

Nov 12, 2020, 8:57 AM

user B
The hacker in you speaking, speaks to me! I just couldn’t find the entry point. This is what I needed. Many many thanks to you!!!

Nov 12, 2020, 9:15 AM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Free to get started, pay-as-you-go on all plans.