Hiding Content Types from the Studio Menu

5 replies
Last updated: May 11, 2020
Is it possible to control what is visible under "Content" all the way on the left side in the studio? Specifically, I'd like to hide some content types from this list - some types only make sense embedded in other objects.
AI Update

Yes, absolutely! You can control what appears in the Content navigation on the left side of Sanity Studio using the Structure Builder. This is perfect for hiding document types that only make sense as embedded objects (like nested content types or components).

By default, the Structure tool displays all document types in your schema, but you can customize this by defining a custom structure in your sanity.config.ts file.

Here's how to do it:

1. Create a structure configuration file:

// structure/index.ts
import type {StructureResolver} from 'sanity/structure'

export const structure: StructureResolver = (S) =>
  S.list()
    .id('root')
    .title('Content')
    .items([
      // Only list the document types you want visible
      S.documentTypeListItem('page').title('Pages'),
      S.documentTypeListItem('post').title('Blog Posts'),
      S.documentTypeListItem('author').title('Authors'),
      // Notice we're NOT including embedded types like 'heroSection' or 'calloutBlock'
    ])

2. Import and configure it in your Sanity config:

// sanity.config.ts
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {structure} from './structure'

export default defineConfig({
  // ...other settings
  plugins: [
    structureTool({structure}),
    // ...other plugins
  ],
})

This approach gives you complete control over what appears in the left navigation. Any document types you don't explicitly include in your structure configuration won't show up in the Content list, though they'll still be usable as embedded objects within other documents.

The Structure Builder documentation covers many more advanced options like filtering, grouping, and creating nested categories if you need more sophisticated organization beyond just hiding certain types.

You can use "object" instead of "document" as the type to achieve this.
object vs document was just what I was looking for, thanks!
Ah, in my haste I overlooked your last sentence πŸ˜„

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?