See Sanity in action 👀 Join us for a live product demo + Q&A →

SKOS Concept Scheme Reference Filter

By Andy Fitzgerald

Use this filter with the Taxonomy Manager Plugin to limit field options to a single concept scheme.

schema.js

	{
		name: 'permission',
		title: 'Sharing Permission',
		description: 'Select the level of sharing allowed for this article.',
		type: 'reference',
		to: [{ type: 'skosConcept' }],
		options: {
			filter: `!(_id in path("drafts.**")) && _id in *[_type=="skosConceptScheme" && title == $scheme].concepts[]._ref`,
			filterParams: {
				scheme: 'Sharing Permission',
			},
		},
	},

The Taxonomy Manager plugin helps you build and maintain standards compliant (SKOS) taxonomies in Sanity Studio. It also helps you define and configure any number of distinct taxonomies for specific purposes using Concept Schemes. This snippet filters a reference field to show only concepts that are part of a given scheme (as defined in filterParams.scheme)

Contributor

Other schemas by author