Custom validation on array length
Simple custom validation that force array length according to another field.
Go to Custom validation on array lengthSimple custom validation that force array length according to another field.
Go to Custom validation on array lengthSuppose 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 ItemsAfter 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 TextCustom input component with a DIY webhook for connecting to APIs beyond publish, update, and delete events.
Go to Custom Input Component with WebhookInternal/External link based on the conditional field example with Next.js component starters
Go to Internal/External Next.js LinkSanity provides various custom functions inside the schema. But getting a reference field value is difficult. Here's the how I do it using fetch.
Go to Get Sanity Reference Field Values inside Custom Schema FunctionsMigration script to convert plain text to block content across your content lake
Go to Migrate plain text field to Portable TextSchemas for adding richer quotes within Portable Text
Go to Rich quotations in Portable TextThis snippet will return only matched item in a sub array inside a document
Go to Sanity groq Filter by item in an arrayA custom input component that conditionally shows fields in from the 'fields' array
Go to Conditional FieldsVisually browse the reference documents you want to select in a document.
Go to Reference document browser inputRun GROQ queries in the studio to populate an array module.
Go to GROQ Reference Lookup + Add & ReplaceText input that for a color hex value (without the #) that displays a color swatch
Go to Color Hex with SwatchMake a rough calculation of word count and reading time for your Portable Text fields
Go to Word count and reading time estimation for GROQ and Portable TextSimple Placeholder Custom Input utilising Sanity UI.
Go to Custom Input: Placeholder