Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirror the schemas/ folder structure in the studio UI #3978

Open
pascalwengerter opened this issue Dec 15, 2022 · 1 comment
Open

Mirror the schemas/ folder structure in the studio UI #3978

pascalwengerter opened this issue Dec 15, 2022 · 1 comment
Labels

Comments

@pascalwengerter
Copy link

pascalwengerter commented Dec 15, 2022

I'm evaluating Sanity as a headless CMS at my current job, and one of the first things the marketing department gave as feedback was the risk of drowning in all the individual schemas, which currently are listed all below each other (and we're just getting started on a not-even-that-big-project).

Sanity could take inspiration from what e.g. Nuxt/NextJS do and provide file-based routing inside the schemas/ folder, at least by default or as configuration option? IIRC there is a way of building this yourself using React, but akin to #3871 this feels like a dearly needed improvement to make Sanity a feasible choice for medium/large projects 😎
Also not sure whether this brings implication akin to #1358

Here's two screenshots of the current small-scale setup which potentially makes the problematic more understandable:

Screenshot 2022-12-15 at 16-24-30 Polarstern CMS – Desk

Screenshot 2022-12-15 at 16 25 37

@toddpadwick
Copy link

This is possible @pascalwengerter but requires fiddling around with the structure builder which is tedious and not a very user-friendly syntax - I often have to do this to group things like global settings and sitewide structures like the below screenshot. So although possible, your suggestion of using a 'nuxt like' directory structure approach is a great idea and would make doing so much easier!

Screenshot 2022-12-23 at 12 11 45

import S from '@sanity/desk-tool/structure-builder'
import { FiSettings, FiHome, FiMenu, FiSearch, FiCreditCard } from "react-icons/fi";


export default () =>
  S.list()
    .title('Content')
    .items([
      
      S.listItem().title('Settings').icon(FiSettings).child(
        S.list().title('Settings').items([
          S.listItem().title('Header banner').icon(FiCreditCard).child(
            S.document().title('Header banner').schemaType('headerBanner').documentId('headerBanner')
          ),
          S.listItem().title('Navigation').icon(FiMenu).child(
            S.document().title('Navigation').schemaType('navigation').documentId('navigation')
          ),
          S.listItem().title('SEO').icon(FiSearch).child(
            S.document().title('SEO').schemaType('seo').documentId('seo')
          ),
          S.listItem().title('Redirects').schemaType('redirect').child(
            S.documentTypeList('redirect')
          )
        ])
      ),
      S.divider(),
      S.listItem().title('Home page').schemaType('homePage').child(
        S.editor().title('Home page').schemaType('homePage').documentId('homePage')
      ),
      S.listItem().title('Solutions').schemaType('solution').child(
        S.documentTypeList('solution')
      ),
      S.listItem().title('Industries').schemaType('industry').child(
        S.documentTypeList('industry')
      ),
      S.listItem().title('Organisational Roles').schemaType('role').child(
        S.documentTypeList('role')
      ),
      S.listItem().title('Landing Pages').schemaType('landingPage').child(
        S.documentTypeList('landingPage')
      ),
      S.listItem().title('About Pages').schemaType('about').child(
        S.documentTypeList('about')
      ),
    ])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants