Using documentTypeList without create button at top of pane in Sanity.io
11 replies
Last updated: Sep 19, 2023
C
Hello everyone, it's User! I was wondering if there's a way to use a
documentTypeListwithout 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
J
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
C
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
J
Oh no! and your document name is 'product'? I gave it a shot anyway š
Sep 19, 2023, 2:55 PM
C
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
J
Alright, I'm using
3.16.7
Sep 19, 2023, 2:58 PM
C
Ah! So let me check if your snippet works by updating the studio š
Sep 19, 2023, 3:01 PM
J
Cool! I'm no Sanity expert. Just trying to learn. But it worked when I tried.
Sep 19, 2023, 3:02 PM
C
Sure, no problem. Thanks for sharing the code snippet and supporting.
Sep 19, 2023, 3:03 PM
C
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
J
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
https://github.com/sanity-io/document-internationalization/blob/210fd462eed177ff55[ā¦]896154318a6756a/docs/06-remove-default-new-document-template.md
Sep 19, 2023, 4:08 PM
C
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.