Joint session with Vercel: How to build intelligent storefronts (May 15th)

Last updated July 18, 2023

Type Taxonomy Setup & Use

By Andy Fitzgerald

Type Taxonomy Setup & Use

Type 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.

First example: Housing Advice, subtopics: Foreclosure Counseling, Homebuyer Education; Residential Housing, subtopics: Long-Term Housing, subtopics: Assisted Living, Independent Living, Nursing Home, Public Housing; Safe Housing, Short-Term Housing, subtopics: Nursing Home, Sober Living. Second example: How-To, subtopics: Clinical Procedure, subtopics: Assessment, Intervention; Electronic Health Record (EHR) How-To, Equipment Operation, subtopics: Equipment Setup, Equipment Troubleshooting, Equipment Use; Newsletter. Third example: Anthropology(258), subtopics: Archaeology(101), Sociology(81); Arts and Music(119), Biology(875), subtopics: Ecology(492), Genetics(45), Health(142), Chemistry(62). Fourth example: Specialty Bikes (65), Mountain Bikes (57), Electric Bikes (50), Road Bikes (44), subtopics: Gravel Bikes (32), Endurance Bikes (7), Electric Road Bikes (6), Touring Bikes (5); Kids' Bikes (40), Hybrid Bikes (27).
Examples of type taxonomies (clockwise from top-left): The Open Eligibility Project (human services), Elemeno Health (resource types, using the Sanity Taxonomy Manager plugin), National Geographic (education subjects), REI (product categories)

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.

Key Features

  • Relationships: Type taxonomies organize concepts in "is-a" relationships: "Nutrition Education" is a type of "Health Eduction," which is a type of "Education." These relationships, when consistently maintained, help users to confidently navigate categories, and can allow algorithms to accurately draw inferences about resources tagged with taxonomy terms.
  • Adaptability: Type taxonomies can be tailored to a wide range of specific content collections or subject domains.
  • Flexibility: Type taxonomies can be used to add structure to simple domains with only a handful of concepts, or can scale to many thousands of terms.

Setting Up a Type Taxonomy

1. Install Sanity Taxonomy Manager


The Taxonomy Manager plugin allows you to create standards compliant relationships that help keep your taxonomy interoperable and reusable.

2. Create a new concept scheme

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

3. Name and describe your taxonomy

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.

4. Add top concepts

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.

5. Add child concepts

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]."

6. Add the taxonomy to a Sanity document scheme

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:

Querying Content

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.

Get content tagged with a concept by prefLabel

*[_type == "post" && subject->prefLabel == "Anthropology"]

Get content tagged with a concept 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:

Each concept has a unique ID you can use to query and reference concepts
Each concept has a unique ID you can use to query and reference concepts

Get content tagged with the child concepts of a specified concept

*[_type == "post" && 
  subject->conceptId in 
    *[_type == "skosConcept" && "8a60d3" in broader[]->conceptId].conceptId
]

Get content tagged with a concept and content tagged by child concepts of that concept

*[_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.

Learn More

Find more examples, applications, and tips in the Sanity Taxonomy Manager Docs >>

Sanity – The Content Operating System that ends your CMS nightmares

Sanity replaces rigid content systems with a developer-first operating system. Define schemas in TypeScript, customize the editor with React, and deliver content anywhere with GROQ. Your team ships in minutes while you focus on building features, not maintaining infrastructure.

Sanity scales from weekend projects to enterprise needs and is used by companies like Puma, AT&T, Burger King, Tata, and Figma.

Was this guide helpful?

Related contributions