Open surjithctly opened 3 years ago
I also found it confusing to setup the desk interface especially when we also integrated intl-input plugin later on in the project.
It's not well documented, if you've never done it before it takes like half an hour to figure this out
I use singleton's a lot, I'm only just looking into Sanity and I was surprised by the complexity needed to create one. I often try to put as much of the site content into the CMS as possible such as an about page etc.
You're looking for...
__experimental_actions: ["update", /* 'create', 'delete', */ "publish"],
It's been a year since this issue was created and Sanity still doesn't want to make the process any simpler? What a shame! Might have to consider another CMS if convenience is not Sanity wants to offer.
@pexeixv I'm with you. But believe me, Sanity is the best CMS apart from these minor issues.
Now I can create singleton in 5 minutes even though its a hack. I'm used to it.
Steps:
Here's how the code looks like: https://github.com/web3templates/stablo/blob/main/studio/schemas/siteConfig.js
Note: Make sure you add step 3 only after 1 & 2.
@surjithctly, I did not understand what @doublejosh initially said. Thanks for elaborating on it. I will definitely use this hack for creating singleton documents.
I've found the easiest way to create singletons is with the Sanity CLI. Create a .json with your types and ids:
[
{
"_id": "privacyPage",
"_type": "privacyPage"
},
{
"_id": "contactUsPage",
"_type": "contactUsPage"
},
{
"_id": "supportPage",
"_type": "supportPage"
}
]
Then from the CLI use sanity documents create myNewDocs.json
Then reference the document id in your Desk Structure, something like:
export default () =>
S.list()
.title("Root")
.items([
S.listItem()
.title("Contact Us")
.child(S.document().documentId("contactUsPage"))
])
Describe the bug Creating a singleton document is really hard in Sanity. Just to make it non-ropeable, I had to create extra files & hours of finding proper docs, asking in the slack community etc.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should not be able to add an array[] if its singleton, Also the configuration should be as simple using Schema. eg:
Screenshots
So, please consider this issue and try to come up with a better solution.
Thank you. ~Surjith