🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Schema structure for Sanity and creating specific fields for each page in a mini-site.

9 replies
Last updated: Mar 11, 2023
Hello everyone! Needed help here.
I would like to ask something regarding the schema structure for Sanity.

I am building a mini-site for a client with few pages and I would like to create specific fields for each page, so when my client need to change the content, they just need to open the Sanity Studio online and change it from there.

So for each page, there will be specific fields. Not the kind of blog where each article contains the same field (title, author, image, etc).

How do you think I should create the schema? Do I have to create a document for every page and create 1 post? Or can I create a specific post which contains specific fields in Sanity?

Thanks in advance! Have a great day everyone.
Mar 11, 2023, 12:17 AM
If you're only going to have a few pages and they're all unique, I would think you would just build individual document types.
Mar 11, 2023, 12:40 AM
You might be able to have a single document type called Page and then implement a "page builder", but I suppose that would depend on other factors.
Mar 11, 2023, 12:41 AM
Thanks for your reply User.
So what you are suggesting is I create few document types and for each document types, I should create 1 post. I will then fetch the data for each page from that post.

As for the page builder, could you explain to me as to how to do page builder inside Sanity?

Thanks a lot! Really appreciate it.
Mar 11, 2023, 2:50 AM
Well, first, you should know I'm still learning Sanity myself. But based on your original question, those are the two ways I could think of to do it. The first way uses unique document types created as singletons. You wouldn't "create 1 post". You would just display the document editor directly when you click on that page. To do that, you will need to create your own desk structure. The page builder method would (theoretically) allow you to create one document type. Then you would create custom modules to drag into the page builder object. Just search the docs for page builder or google around for examples. It sounds like the first approach would make more sense if you're just looking to use text fields for each page.
Mar 11, 2023, 2:58 AM
Yes the first one is the one i’m looking for! I have just read the documentations for Singleton Document. Seems quite tricky but I’ll give it a shot. Thanks a lot User!
Mar 11, 2023, 3:09 AM
That's actually the easier (or less complex) of the two. Give it a shot and let me know if you need more direction.
Mar 11, 2023, 3:10 AM
Mar 11, 2023, 3:11 AM
Perfect! Really appreciate your help!
Mar 11, 2023, 3:18 AM
My pleasure! Have fun!
Mar 11, 2023, 3:19 AM

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?