Search Taxonomy Setup & Use
Search taxonomies (or thesauri) are crucial tools in ensuring that your site search feature gets users where they want to go.
Go to Search Taxonomy Setup & UseType taxonomies are a crucial tool for organizing digital content for findability and discovery. Product catalogs, services listings, resource types, and subject hierarchies are all commonly characterized by "type" organization: each child category describes a more specialize type of thing than the parent category. Well defined type taxonomies area powerful tool for making your content more discoverable and reusable across contexts.
In this guide you'll learn what makes "type" taxonomies different from other kinds of taxonomy structures, like topic or faceted taxonomies, and will learn how to set up a type taxonomy in the Sanity Taxonomy Manager plugin. You'll also see examples of how to integrate your taxonomy into document schemes and query across related concepts for tagged documents.
Type classification helps users navigate and browse categories from general to more specific and narrow down large content sets to specific items that meet their needs. It also allows information designers to assemble related content into meaningful collections and to provide richer search results based on parent/child relationships.
When combined with search term and traffic data, type taxonomies help you to draw deeper insight from visitor behaviors, and they can play a vital role in providing AI the ground truth it needs to return reliable, trustworthy results.
These instructions assume you have already identified a taxonomy to adopt or adapt, or have designed one for your specific content needs. Taxonomy provisioning and creation is beyond the scope of this guide, but you can find a primer on finding and designing taxonomies in the Sanity Taxonomy Manager docs.
The Taxonomy Manager plugin allows you to create standards compliant relationships that help keep your taxonomy interoperable and reusable.
Concept Schemes are used to create multiple taxonomies in a single project, and, where needed use the same concepts across them. This gives you a single source of truth for each concept you define, and allows you to establish semantic relationships between individual taxonomies.
Add a new Concept Scheme with either the global "new document" button, or the "new document" button in the Concept Schemes list view
Add a clear name and describe the purpose and goals of your taxonomy to users. Tagging content with managed terms may be new to your content creators: good descriptions can help users understand why the tagging step is important.
Describe what your taxonomy is for, as opposed to only what it is of: a taxonomy of a topic may feel superfluous; a taxonomy for a purpose can help bring authors and collaborators along.
Top Concepts are the entry points to your type hierarchy. While creating top concepts is not strictly required, using them can help you follow good modeling practices (by calling out "orphans" and showing unbalanced structures) and gives you more options for filtering terms and querying tagged content.
Include definitions and examples as you go.
Child concepts are the narrower types in your taxonomy. To create a consistent "is-a" hierarchy, you should be able to say that "[child concept] is a [parent concept]."
Sanity Taxonomy Manager supports up to 5 levels of hierarchy. This is for performance and to help ensure semantic integrity,
You're now ready to publish your taxonomy, integrate it into your content scheme, and start tagging content. Taxonomy Manager includes two helper functions for ensuring that only the appropriate concepts are available for a given field:
Once your content is tagged, the semantics built into your type taxonomy allow you to retrieve content based on single concepts, or on relationships between concepts.
*[_type == "post" && subject->prefLabel == "Anthropology"]
Querying by prefLabel
is convenient in some situations, but if your labels ever change, you'll need to rewrite all your queries. You can write more resilient code by querying by conceptID
.
*[_type == "post" && subject->conceptId == "8a60d3"]
Each concept you create in Taxonomy Manager is automatically given a unique conceptId
. You can find the conceptId
below the Base URI field in the concept editor pane:
Taxonomy Manager's conceptId
allows you to reuse and reference the same Concepts and Concept Schemes across studios and datasets.
*[_type == "post" &&
subject->conceptId in
*[_type == "skosConcept" && "8a60d3" in broader[]->conceptId].conceptId
]
*[_type == "post" &&
subject->conceptId == "8a60d3" ||
subject->conceptId in
*[_type == "skosConcept" && "8a60d3" in broader[]->conceptId].conceptId
]
Well defined, standards compliant taxonomy provides a ground truth foundation for scores of different discovery, personalization, and business intelligence applications. The queries above offer just a few examples of how assiduously applied taxonomy can help you manage content based on the relationships you've created. Your dataset, taxonomy, and goals will be the most natural drivers for how your taxonomies are used to create value.
Find more examples, applications, and tips in the Sanity Taxonomy Manager Docs >>
Sanity Composable Content Cloud is the headless CMS that gives you (and your team) a content backend to drive websites and applications with modern tooling. It offers a real-time editing environment for content creators that’s easy to configure but designed to be customized with JavaScript and React when needed. With the hosted document store, you query content freely and easily integrate with any framework or data source to distribute and enrich content.
Sanity scales from weekend projects to enterprise needs and is used by companies like Puma, AT&T, Burger King, Tata, and Figma.
Search taxonomies (or thesauri) are crucial tools in ensuring that your site search feature gets users where they want to go.
Go to Search Taxonomy Setup & UseFaceted taxonomies are a great option for organizing resources that don't fit neatly into hierarchical structures.
Go to Faceted Taxonomy Setup & UseAdd topic-based relationships to your content to make it more discoverable and reusable across contexts.
Go to Topic Taxonomy Setup & UseA comprehensive guide to self-hosting Sanity Studio on DreamHost with GitHub Actions for continuous integration.