✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Using documentTypeList without create button at top of pane in Sanity.io

11 replies
Last updated: Sep 19, 2023
Hello everyone, it's User! I was wondering if there's a way to use a
documentTypeList
without having the create button action at the top of the pane. Unfortunately, using a static list doesn't work for us because it removes the search and ordering features that we need to keep in the pane. Your help would be greatly appreciated.
Sep 19, 2023, 2:19 PM
Not sure but this maybe works using templates filter in your config.
export default defineConfig({
  // ... other configs
  schema: [
    types: [
      // ... your types
    ],
    templates: (prev) => prev.filter((template) => !['product'].includes(template.id)),
  ]
})
Sep 19, 2023, 2:33 PM
Hey User! I really appreciate your response, but unfortunately, the snippet didn't work this time. I'm still seeing the create button at the top of the pane.
Sep 19, 2023, 2:50 PM
Oh no! and your document name is 'product'? I gave it a shot anyway 🙂
Sep 19, 2023, 2:55 PM
Yes, the name is "product" 🙂What version of Sanity are you currently in? I'm using the
3.11.1
Sep 19, 2023, 2:57 PM
Alright, I'm using
3.16.7
Sep 19, 2023, 2:58 PM
Ah! So let me check if your snippet works by updating the studio 👍
Sep 19, 2023, 3:01 PM
Cool! I'm no Sanity expert. Just trying to learn. But it worked when I tried.
Sep 19, 2023, 3:02 PM
Sure, no problem. Thanks for sharing the code snippet and supporting.
Sep 19, 2023, 3:03 PM
user T
Hey there! I just wanted to let you know that I had initially placed the code snippet you shared with me in the wrong spot. But thanks to you, the issue is now solved! 😄By any chance, when you get a moment, could you please share the documentation you used to find that snippet? I'm really eager to learn more about it.
Hope you have a fantastic day!
Sep 19, 2023, 3:31 PM
Haha fantastic! Well it's kind a random. I'm using the Document Internationalization plugin for Sanity and in the bottom of the readme there is a link called "Remove default new document template" and while testing it out I got the result you were looking for.
https://github.com/sanity-io/document-internationalization/blob/210fd462eed177ff55[…]896154318a6756a/docs/06-remove-default-new-document-template.md
Sep 19, 2023, 4:08 PM
Perfect timing then! haha 🙂Thanks again for your support.
Sep 19, 2023, 5:02 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?