Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th
Published August 16, 2023

Faceted Taxonomy Setup & Use

By Andy Fitzgerald

Faceted taxonomies are a great option for organizing and classifying resources that don't fit neatly into a single hierarchical tree structure. Consider a faceted taxonomy if you find that you repeat categories at the lower levels of your hierarchical taxonomy, or if there are no clear candidates for top level categories, such as when resources need to be classified in different ways for different audiences.

In this guide you'll learn what makes faceted taxonomies different from other kinds of taxonomy structures, like type or topic taxonomies, and you'll learn how to set up a faceted taxonomy in the Sanity Taxonomy Manager plugin. You'll also see examples of how to integrate your taxonomy into document schemes and how to use facets to enhance findability and discovery for your users.

Topic, Geographic Location, and Places We Protect facets on the Nature Conservancy search results page help users locate content

Facets allow users to select which elements of your classification scheme are most important to them. In this example from the Nature Conservancy search results page, a visitor to this page can narrow results either by either Topic, Geographic Location, or Conservancy Site first. The resulting articles—and facets available—are then narrowed based on this selection.

Organizing recipes offers another classic example of faceted taxonomy in use. Recipes can be described by meal, region of origin, type of dish, difficulty to prepare, price, and more. You could structure these attributes as a hierarchy, but you would end up with a lot of duplication. You would also force those using your hierarchy to navigate through many levels they may not care about to find the attribute they do care about. This makes locating particular resources harder, and comparing resources across the hierarchy more difficult still.

Side by side comparison of recipe categories presented as a hierarchy and as facets

Faceted classification offers an alternative to the rigidity of tree structures for content that has similar attributes. Epicurious.com, for example, uses facets to allow users to filter by a half dozen different attributes common to the "recipe" content type.

The "Cuisine" facet for a "tacos" search result on Epicurious.com


Both of these example illustrate an important consideration in the design of effective facets: the attributes described in each facet should be mutually exclusive (you'll hear taxonomists refer to this as "orthogonality"). On the Epicurious site, for example, "Cuisine" has no overlap with "Ingredients" or "Dish." The label "Caribbean" will only ever appear in the Cuisine menu.

Likewise, on the Nature Conservancy site, the potential values of "Geographic Region" and "Places We Protect" are defined at different levels of granularity: states (which represent political boundaries) and specific preservation locations (which represent ecological boundaries). No member of one facet is a member of another; each facet is orthogonal.

Key Features

  • Relationships: While orthogonality is a key feature of the relationship between facets, within each facet concepts may be structured in any way that makes sense to the taxonomy's target users. Simple lists are by far the most common, but individual facets can also be structured as hierarchies or trees with different kinds of relationships (part/whole, cause/effect, sequence, etc).


Introducing multiple levels into individual facets can increase the complexity of an interface quickly. This can be an effective approach for complex domains aimed at expert users, but use it with caution.

  • Adaptability: While special care needs to be taken to identify and test facets based on user and business needs and the content being organized, the collection of terms within individual facets tend to accommodate new entities easily. This makes them attractive options for resource collections of mostly homogenous content that is expected to evolve and change over time.
  • Size Limitations: Facets allow you to present multiple, mutually exclusive organization schemes easily. The tradeoff is that they introduce additional complexity into discovery and findability. If you find you have fewer than three facets, a type or topic taxonomy may work just as well for your content collection (and introduce less complexity for your users).
    At the upper end, unless you're building a system for expert users, limit your facets to a half dozen or so. As taxonomy expert Patrick Lambe notes, "large numbers of facets (above 7 or so) are cognitively difficult for users to manipulate" (42).

Setting Up a Topic Taxonomy

1. Install Sanity Taxonomy Manager


These instructions focus on how to set up a faceted taxonomy for use in Sanity Studio with the Taxonomy Manager plugin. For a detailed introduction to the steps of facet design, see Denton, Kwasnik, and the additional resources listed at the end of this guide.

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.


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.

4. Create Facets

Add the salient facets that best describe your content set from the point of view of your intended users as Top Concepts. Using Top Concepts for your facets makes it easy to visualize your facets in the Studio, and makes it easier to associate facets with Studio form fields.


Not everything that constitutes an orthogonal attribute necessarily makes a useful facet. Facets add complexity, so take the time to ensure that the facets you choose add commensurate value for your users and business goals.

5. Add Facet Values

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 faceted taxonomy allow you to retrieve content based on single concepts, or on relationships between concepts. You can also generate a list of your facets and their values for use in an interface.

Get content tagged with a facet value by `prefLabel`

*[_type == "post" && foliageColor->prefLabel == "Green"]


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.

Get content tagged with a facet value by `conceptID`

*[_type == "post" && foliageColor->conceptId == "f125f5"]

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


Taxonomy Manager's conceptId allows you to reuse and reference the same Concepts and Concept Schemes across studios and datasets.

Get content tagged with a specific concept or its children within a hierarchical facet

*[_type == "post" && habitat->conceptId == "8833c1" ||
  habitat->conceptId in 
    *[_type == "skosConcept" && "8833c1" in broader[]->conceptId].conceptId

Generate a list of facets for use in an interface

A common use case is to display facets as a set of filters which users can use to narrow down resources. This query generates a list of facets and the values associated with each:

*[_type == "skosConceptScheme" && schemeId == "cf76c1"].topConcepts[]->{
  "facet": prefLabel,
  "values": *[_type == "skosConcept" && references(^._id)].prefLabel

You'll want to update the facet values displayed—and sometimes the content count for each facet—based on the user's selection. Unless you have a very large content collection this is often best managed on the front end, which allows your users to explore, refine, and revise facet selections without needing to refresh the page with each change.


Don't include facet or facet values with no content; this would lead users to an empty set — not satisfying!

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.

Additional Resources

Learn More

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

Sanity – build remarkable experiences at scale

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.

Other guides by author

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.

Andy Fitzgerald
Go to Search Taxonomy Setup & Use

Topic Taxonomy Setup & Use

Add topic-based relationships to your content to make it more discoverable and reusable across contexts.

Andy Fitzgerald
Go to Topic Taxonomy Setup & Use

Type Taxonomy Setup & Use

Add semantic relationships to your content to make it more discoverable and reusable across contexts.

Andy Fitzgerald
Go to Type Taxonomy Setup & Use

Self-Hosting Sanity Studio with GitHub Actions

A comprehensive guide to self-hosting Sanity Studio on DreamHost with GitHub Actions for continuous integration.

This is an external link at:www.andyfitzgeraldconsulting.com
Andy Fitzgerald
Go to Self-Hosting Sanity Studio with GitHub Actions