🗓️ Everything *[NYC] is back. A free gathering for AI builders. Sept 9

Taxonomy Manager

Create and manage SKOS compliant taxonomies, thesauri, and classification schemes in Sanity Studio.

By Andy Fitzgerald

v2 install command (deprecated)

yarn add sanity-plugin-taxonomy-manager@1.0.5

Install command

npm i sanity-plugin-taxonomy-manager

Sanity Taxonomy Manager

NPM Version License

Create and manage SKOS compliant taxonomies, thesauri, and classification schemes in Sanity Studio.

taxonomy manager plugin screenshot

Documentation

For full documentation, visit sanitytaxonomymanager.com.

Features

  • Adds two document types to your Sanity schema which are used to generate SKOS compliant concepts and taxonomies: skosConcept and skosConceptScheme
  • Includes reference filter helpers to allow you to easily include a specific taxonomy, or particular branch of a taxonomy in your Sanity documents
  • Encourages taxonomy and thesaurus design best practices by enforcing disjunction between Broader and Related relationships and disjunction between Preferred and Alternate/Hidden labels
  • Standards compliant architecture means that taxonomy terms and structures can be migrated to standards compliant standalone tools when you need higher level taxonomy and knowledge graph support.

Installation

Compatible with Sanity Studio v5 and v6 (React 19).

In your Sanity project folder, run:

npm install sanity-plugin-taxonomy-manager
# or
pnpm add sanity-plugin-taxonomy-manager
# or
yarn add sanity-plugin-taxonomy-manager

Configuration

Add the plugin to your project configuration to add the Taxonomy Manager Tool to your studio workspace.

// sanity.config.js

import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {taxonomyManager} from 'sanity-plugin-taxonomy-manager'
import {schemaTypes} from './schemas'

export default defineConfig({
  name: 'default',
  title: 'Sanity Studio',
  projectId: '<projectId>',
  dataset: 'production',
  plugins: [
    structureTool(),
    // Include the taxonomy manager plugin
    taxonomyManager({
      // Optional: Set a Base URI to use for new concepts & concept schemes
      baseUri: 'https://example.com/',
      // Optional: Use `customConceptFields` and `customSchemeFields` keys to add custom fields to Concept or Concept Scheme document types
      customConceptFields: [
        {
          name: 'sameAs',
          title: 'Same As',
          type: 'url',
          description:
            'Specify a fully qualified IRI that identifies the same concept in another vocabulary',
        },
      ],
    }),
  ],
  schema: {
    types: schemaTypes,
  },
})

The plugin adds skosConcept and skosConceptScheme document types to your studio. Use a filter on documentTypeListItems in the desk tool configuration to exclude taxonomy manager document types from your main document view.

// sanity.config.js

import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {taxonomyManager} from 'sanity-plugin-taxonomy-manager'
import {schemaTypes} from './schemas'

export default defineConfig({
  name: 'default',
  title: 'Sanity Studio',
  projectId: '<projectId>',
  dataset: 'production',
  plugins: [
    structureTool({
      structure: (S) =>
        S.list()
          .title('Content')
          .items([
            ...S.documentTypeListItems().filter(
              (listItem) => !['skosConcept', 'skosConceptScheme'].includes(listItem.getId())
            ),
          ]),
    }),
    taxonomyManager(),
  ],
  schema: {
    types: schemaTypes,
  },
})

Development

This repo bundles a dev Studio as a workspace member (studio/). Run it and open the Taxonomy tool:

pnpm dev

See the development docs for details on plugin design intent, architecture, and functional composition.

License

MIT © Andy Fitzgerald See LICENSE

Related contributions