Build a custom taxonomy provider for Sitecore Content Tagging

Current version: 10.2

The taxonomy provider for Sitecore Content Tagging is responsible for managing tags, and can create and store tags based on TagData objects. The taxonomy provider returns Tag objects based on tag ID, and can also return the parent and/or children of a tag if you have implemented structured taxonomy in the provider. 

This topic describes how to:

Implement a custom taxonomy provider

To create your own taxonomy provider:

  • Implement the Sitecore.ContentTagging.Core.Providers.ITaxonomyProvider interface as illustrated in the following example:

    RequestResponse
    public class ExampleTaxonomyProvider : ITaxonomyProvider
    { 
        public string ProviderId => "ExampleTaxonomyProvider";
    
        public IEnumerable<Tag> CreateTags(IEnumerable<TagData> tagData)
        {
            var tags = new List<Tag>();
            // CREATE AND STORE HERE
            Tag tag = null;
            tags.Add(tag);
            return tags;
        }
    
        public Tag GetTag(string tagId)
        {
            // receive tag from repository based on tagId here
            Tag tag = null;
            return tag;
        }
    
        public Tag GetParent(string tagId)
        {
            // implement if needed
            return null;
        }
    
        public IEnumerable<Tag> GetChildren(string tagId)
        {
            // implement if needed
        return null;
        }
    }

Add the taxonomy provider to the configuration file

To use your provider in a content tagging configuration:

  • Register it in the configuration file, as in the following example:

    RequestResponse
    <contentTagging>
        <providers>
            <taxonomy>
                <add name="ExampleTaxonomyProvider"
    type="Custom.ContentTagging.Core.Providers.ExampleTaxonomyProvider,
    Custom.ContentTagging.Core" />
            </taxonomy>
        </providers>
    </contentTagging>

Do you have some feedback for us?

If you have suggestions for improving this article,