Skip to content
Sanity
    • Platform

      Sanity Studio

      Flexible editing environment

      APIs

      Connect to anything

      Content Lake

      Real-time database

      Try product demo

      Features

      Real-time collaboration

      Fearlessly work with content

      Precise content querying

      Treat content as data with GROQ

      Localization

      Coherent messaging across territories

    • Use cases

      E-commerce

      Richer shopping experiences

      Marketing sites

      Control your story

      Products & services

      Innovate and automate

      Mobile apps

      Content backend for every OS

      View all

      Integrations

      Shopify
      Mux
      Vercel
      Netlify
      Algolia
      Cloudinary
      BigCommerce
      Commerce Layer
      Smartling
      Transifex
      View all
    • Learn

      Documentation
      Studio API Reference
      API reference
      Guides
      GROQ cheat sheet
      Sanity UI
      Get started

      Build and share

      Templates
      Tools and plugins
      Schemas and snippets
      Project showcase
      Share your work
      Browse Exchange

      Frameworks

      React
      Vue
      Next.js
      Nuxt.js
      Svelte
      Remix
      Gatsby
      Astro
      Angular
      Eleventy
      View all
    • Discover

      Blog
      Resource library
      Agency partners
      Become a partner
      Technical support
      Talk to sales

      Case studies

      Puma

      Source of truth for global markets

      Aether

      Unique digital shopping experience

      Morning Brew

      Omnichannel media distribution

      InVision

      Delivering exceptional customer experiences

      View all

      Popular guides

      Headless CMS
      Structured content
      Content modeling
      Headless SEO
      Static websites
      View all
    • Enterprise
    • Pricing
    • Log in
    • Contact sales
    • Get started
Contact salesGet started
Published September 28th 2018

Structure Sanity Studio to Your Heart’s Content!

We have launched structure builder for Sanity Studio. Now you can customize how content types and documents should be listed out.

Even Eidsten Westvang

Sanity.io co-founder and product person

One of the most frequent feature requests we have had since launch is the capability to just have one of a certain document type. Think some global configuration or meta-info. It has been called “singletons” by some. It has been technically possible the whole time, but there hasn’t been an easy and obvious way to display it in Sanity Studio’s Desk Tool, our open source content editor. Until now.

With the recent release (sanity upgrade) we introduce the new structure builder, which gives you full control over how documents are listed out in the Desk Tool. But its capabilities go far beyond just adding support for singletons: It makes it possible to filter, group, and list out documents in hierarchies.

Because the structure builder just configures the view, you don’t have to change your existing content model to use it, which means that you can display the same documents in different ways, at the same time. The structure supports promises and observables, which also makes it possible to tie how documents are laid out to external APIs, even in real-time. It’s powerful stuff!

As with most of what we make for Sanity Studio, structure builder is mostly just JavaScript (the package it’s actually implemented in TypeScript, which adds some nice autocomplete features in code editors that supports it). You can get up and running in a couple of minutes by reading the introduction in the documentation.

import S from '@sanity/desk-tool/structure-builder'

const hiddenDocTypes = listItem => !["config"].includes(listItem.getId())

export default () =>
S.list()
  .title('Content')
  .items([
    S.documentListItem()
      .id('global-config')
      .title('Configuration')
      .schemaType('config'),
    ...S.documentTypeListItems()
      .filter(hiddenDocTypes)
  ])
Example of global configuration in the Ecommerce example project

We believe the new Structure Builder sets Sanity even more apart when it comes to giving you full flexibility for your content authoring needs. We will continue to improve its capabilities and can’t wait to get your feedback in our community Slack and to see what you’ll make with it.

Product

Sanity StudioAPIsContent LakeSecurity & Compliance
  • Sanity vs Contentful
  • Sanity vs Strapi
  • Sanity vs Wordpress
  • Sanity vs Adobe Experience Manager
  • Sanity vs Hygraph
  • Sanity vs Sitecore
  • Sanity vs Storyblok
  • Sanity vs Contentstack
  • Sanity vs Prismic
  • Sanity vs Drupal
  • Sanity vs ButterCMS

Resources

DocumentationBlogResource libraryCase Studies
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Making a PWA
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
  • Next.js blog
  • Next.js personal website
  • Clean Next.js + Sanity app
  • Clean Remix + Sanity app
  • Clean SvelteKit + Sanity app
  • All Templates
  • Agency partners
  • Technology partners
  • Headless CMS 101
  • Static Sites 101
  • Headless Commerce 101
  • CMS for enterprise
  • Headless SEO
  • Localization
  • Content as a Service
  • What is a DXP?
  • Typescript 101
  • Ecommerce SEO
  • What is a Composable DXP?
  • What is an API?
  • GraphQL vs REST
  • React CMS
  • Next.JS CMS
  • CMS for Shopify
  • API-first CMS
  • Content platform
  • Multilingual CMS
  • Static Site CMS
  • Gatsby CMS
  • Node CMS
  • E-commerce CMS
  • Vue CMS
  • Angular CMS
  • GraphQL CMS
  • Newspaper CMS
  • Magazine CMS
  • CMS for apps
  • Remix CMS
  • Nuxt CMS
  • SvelteKit CMS
  • Agile CMS
  • Eleventy CMS

Company

Contact SalesEnterpriseCareersTerms of ServicePrivacy PolicyAccessibility Statement

Stay connected

  • GitHub
  • Slack
  • Twitter
  • YouTube
  • Stack Overflow
  • Blog RSS
  • Newsletter
©Sanity 2023