Some Snippet ppl might find useful as well as some guides I wrote for Sanity.io. I am also happy to help with any questions you might have. 😄
Learn how to setup a document bin for restoring deleted documents in Sanity.
This code is explained in the corresponding guide Create a bin for logging and restoring deleted documents. In addition to this code you will need to set up a webhook to listen for deletions and store them in the bin logs.
Here you will find the code to the guide Ultimate Guide for customising Portable Text - From schema to React component.
The code to the guide Ultimate Guide for customising Portable Text - From schema to React component. The guide leads through the all the steps you need to level-up your use of Portable Text: from setting up block content, adding custom blocks and renderers for the Portable Text Editor in your studio. It will also help you query for everything and render your awesome content in React! These examples are in Typescript, see the guide for JS. 😎 See Snippets
🔥 Template for singleton in pages folder 🔥
When customising your desk structure, it can be hard to keep track of all parts. This is why I split the code up in and packed it into singletons (here pages) and documentType
structures, which are then imported into a deskStructure/index.js
. This way your code stays readable and managable by people, especially if they have ADHD like me 😉. Structure Builder
can be a bit unruly, so here you go .... See Snippets
Ever wondered how to use Sanity UI in your Studio GUI? Well here are some ideas! See Snippets
Use PT and see how custom renderer can be generated for the editor in the studio as well as get GROQ queries and serializers to work in Next/React. See Snippets
How to systematically generate SEO/Meta information in your studio and use it in your front end. This might help you get an understanding of how to setup a working next/meta
component, which you can reuse but also has a default just in case. See snippets
Not everything is polished here ... just the most important functionality is up and running and beginners might find it useful 😄