UNPKG

@sanity/cli

Version:

Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets

38 lines (32 loc) 1.23 kB
import {ListItemBuilder, StructureResolver} from 'sanity/structure' import collections from './collectionStructure' import products from './productStructure' /** * Structure overrides * * Sanity Studio automatically lists document types out of the box. * With this custom structure we achieve things like showing the `home` * and `settings` document types as singletons, and grouping product details * and variants for easy editorial access. * * You can customize this even further as your schemas progress. * To learn more about structure builder, visit our docs: * https://www.sanity.io/docs/overview-structure-builder */ // If you add document types to structure manually, you can add them to this function to prevent duplicates in the root pane const hiddenDocTypes = (listItem: ListItemBuilder) => { const id = listItem.getId() if (!id) { return false } return !['collection', 'media.tag', 'product', 'productVariant', 'vendor'].includes(id) } export const structure: StructureResolver = (S, context) => S.list() .title('Content') .items([ collections(S, context), products(S, context), S.divider(), ...S.documentTypeListItems().filter(hiddenDocTypes), ])