Is your Microcopy unique?
A custom validation to check if your Microcopy documents have unique keys and values for a specific namespace.
Go to Is your Microcopy unique?A custom validation to check if your Microcopy documents have unique keys and values for a specific namespace.
Go to Is your Microcopy unique?Setting up a live preview and want to fetch a document's draft, with a fallback for the published document when there are no drafts? Check this out.
Go to Select draft OR published documentThis validation can be used if you have two fields and you require one or the other to be filled
Go to One or the other validationThis snippet can be used to fetch current, previous and next articles based on publication date and related tags.
Go to Get current, previous and next post, filtered by tagsValidation of url input to allow certain URI schemes (mailto, tel and more included)
Go to Validation of url input to allow certain URI schemesUse the renderDefault function to easily control your available array options.
Go to Filter Array Options Based on the Current User RoleThis is a quick tip on how to truncate a Sanity block field to create an excerpt using GROQ.
Go to Using GROQ to create an excerpt for a Sanity blockOrder by last name
Go to Use GROQ to order by last name in where name is stored as full nameSimple custom validation that force array length according to another field.
Go to Custom validation on array lengthUses @sanity/asset-utils to validate an uploaded image by its ID
Go to Schema validation rules to enforce image size or file typeSuppose you have an Array Reference to Category and you want to get all posts with one of the categories listed in the current post. This is usually when you need to get related items.
Go to Get related items of a post in sanity by comparing category array reference with another arrayA short snippet to filter category, tags or other document based on total referenced count.
Go to Sanity GROQ Filter category by highest reference count in other documentsSometimes you want to validate items in an array, here is how
Go to Validation of Array ItemsManage Meta tags, openGraph, and locale Data for your site within Sanity Studio
Go to Website Meta DocumentAfter the approval (switch to true), the date of this operation is stored in a hidden field.
Go to Custom Input Component: Save the date of document approvalSnippet for `internalLInk` Reference in GROQ and rendering it in React/Next.js frontend using Portabletext.
Go to Sanity internalLink render in React with Portable TextFetch content from the base locale regardless of whether the current document is the base or translation document
Go to Query for slugs for all available locales of this documentUsing webhooks and the Sanity API, you can merge content changes and user information
Go to Getting user information with webhooks