Hiding the "+" button in Sanity's document list pane
Looking at your code, the issue is that the nested S.documentList() in your "Posts By Category" structure doesn't specify which document types can be created, so it's showing a generic "+" button that leads to an empty creation menu.
To hide that "+" button, you need to pass an empty array to initialValueTemplates() on your documentList(). This tells Sanity that no documents should be creatable from that particular list:
S.listItem()
.title('Posts By Category')
.child(
S.documentTypeList('category')
.title('Posts by Category')
.child((categoryId) =>
S.documentList()
.apiVersion('2024-06-01')
.title('Posts')
.filter('_type == "post" && $categoryId in categories[]._ref')
.params({categoryId})
.initialValueTemplates([]), // Add this line to hide the + button
),
)The .initialValueTemplates([]) method controls which document creation templates are available in that specific list. By passing an empty array, you're telling the Structure Builder that no creation options should be shown, which effectively hides the "+" button.
This makes sense for your use case since you're showing a filtered list of posts based on category selection. Users should probably create posts from the main "Posts" list item instead, where they can properly set all fields including the category.
If you later decide you want to allow creating posts directly from the category view (with the category pre-populated), you could configure a custom initial value template that automatically sets the category reference based on the categoryId parameter.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.