Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@goldsucc/sanity-plugin-taxonomy-manager

GoldSucc15MIT3.2.7TypeScript support: included

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

sanity, sanity-plugin, SKOS, taxonomy, thesaurus

readme

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

In your Sanity project folder, run

npm i sanity-plugin-taxonomy-manager

or

yarn add sanity-plugin-taxonomy-manager

🚨 Breaking Changes for Concept Fields

Version 3 of Sanity Taxonomy Manager includes changes to baseUri and skosConceptScheme fields that were part of version 1 and early (patch) versions of v2. If you are upgrading to Taxonomy Manager version 3 with concepts created in one of these early versions, install v2.3.1 first: it includes field utilities to help you migrate your terms and schemes to version 3.

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 {deskTool} from 'sanity/desk'
import {taxonomyManager} from 'sanity-plugin-taxonomy-manager'
import {schemaTypes} from './schemas'

export default defineConfig({
  name: 'default',
  title: 'Sanity Studio',
  projectId: '<projectId>',
  dataset: 'production',
  plugins: [
    deskTool(),
    // Include the taxonomy manager plugin
    taxonomyManager({
      // Optional: Set a Base URI to use for new concepts & concept schemes
      baseUri: 'https://example.com/',
    }),
  ],
  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 {deskTool} from 'sanity/desk'
import {taxonomyManager} from 'sanity-plugin-taxonomy-manager'
import {schemaTypes} from './schemas'

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

Contributing

Community collaboration is highly encouraged. To make sure your contributions are aligned with project goals and principles, please read the contributing docs before submitting a pull request.

License

MIT © Andy Fitzgerald See LICENSE

changelog

📓 Changelog

All notable changes to this project will be documented in this file.

The format of this document is based on Keep a Changelog, and this project adheres to Semantic Versioning.

3.0.0 - 2023-06-28

Added

  • Standalone tool pane in Sanity Studio
  • Additional taxonomy building instructions to Docs
  • Contributing section to Docs
  • Documentation for upgrade paths for schemas still using v1.0 configurations

Removed

  • Support for some baseUri and skosConceptScheme fields created with v1.0 schema

2.3.1 - 2023-06-25

Added

  • Document upgrade notice for schemas still using v1.0 configuration

2.3.0 - 2023-06-12

Added

  • Collapse / expand functionality to tree view
  • Keyboard and screen reader support for collapse/expand, editing actions, and detail links
  • Clarify types and parameters for plugin and helpers
  • Add standalone documentation site
  • Add progressive disclosure to description fields and improve SKOS Concept field descriptions

2.2.2 - 2023-06-06

Added

  • Specification of Base URI in plugin configuration in sanity.config
  • Concept ID generator (for concepts and schemes using previous versions)
  • Reference filter helpers

2.2.1 - 2023-06-01

Added

  • Add informational dialogues to taxonomy terms when definition, example, or scope note content is available.

2.2.0 - 2023-05-29

Added

  • Concept links to hierarchy view
  • "Add top concept" and "add concept" functionality to hierarchy view
  • Description to Tree View pane
  • "Add Child Concept" functionality to concepts in hierarchy view
  • "Remove Concept" functionality to concepts in hierarchy view
  • Title and description guidance and functionality in hierarchy view

2.1.0 - 2023-05-10

Added

  • Base URI field to skosConceptScheme
  • Add History, Editorial, and Change Notes
  • Add detailed descriptions and examples for Note fields

Changed

  • Improved Base URI field description content and formatting

2.0.6 - 2023-05-04

Added

  • Add Tree View validation of 5 level hierarchy limit
  • Add icons and messaging for schema concepts over 5 levels deep
  • Add "getting started" messaging for new Concept Schemes
  • Add "keeping going" messaging for Concept Schemes with no concepts yet assigned.

2.0.5 - 2023-05-01

Fixed

  • Bug in hierarchy tree that caused it to be rendered twice.
  • Issue with style forced the use of inline styles (converted to Styled Components)

Changed

  • Modularized hierarchy tree components

2.0.4 - 2023-03-19

Added

  • Add detail for Preferred Label and Base IRI usage to README.

2.0.3 - 2023-02-04

Added

  • Revise Concept preview subtitle to show immediate broader term(s) only.

2.0.2 - 2023-01-29

Added

  • Support for single level concept schemes with no designated topConcept: Handle absence of topConcepts and omit 'orphan' label when no topConcept is present
  • Data specific Types for components & schema definitions

2.0.1 - 2023-01-21

Fixed

  • Improved taxonomy tree effect to eliminate extra delay in fetching from the content lake.

2.0.0 - 2023-01-16

⚠ BREAKING CHANGES

  • This version no longer works in Sanity Studio V2

Added

  • Initial Sanity Studio V3 release

2.0.0-beta.0 - 2023-01-16

Added

  • Beta Sanity Studio V3 release

1.0.5 - 2022-11-23

Fixed

  • README link that was not behaving as intended across applications.

1.0.4 - 2022-10-20

Fixed

  • Taxonomy Tree CSS was spilling over into description fields for the studio. Added unique classes to keep plugin styling from being too enterprising.

1.0.3 - 2022-09-29

Fixed

  • Concept Scheme Tree View bug that caused by missing parent document value on first render.

Changed

  • Improved taxonomy scheme field descriptions.

1.0.2 - 2022-09-28

Fixed

  • Fixed bug introduced by Sanity Studio update 2.33.0 that made parent unavailable to custom components directly.

Changed

  • Made concept scheme assignment async to improve consistency of Concept Scheme Tree View rendering.

1.0.1 - 2022-06-12

Added

  • Add "Concept Scheme Tree View" custom component to Taxonomy Schemes view. List shows hierarchy, Top Concepts, orphans, and polyhierarchial concepts.

1.0.0 - 2022-04-01

Added

0.2.0 - 2022-03-22

Added

  • Move "Settings" data into config.json, update initial value fields/functions, and remove "Taxonomy Settings" document scheme

0.1.0 - 2022-03-17

Added

  • Tag initial development release
  • Update README with installation, basic use instructions, and development warning
  • Add changelog
  • Migrate SKOS Taxonomy Management schemas from local development branch to (this) plugin repository