You are working with the TaxonomyManager class, which is the manager class for taxonomies. It has helper methods for creating a taxonomy: CreateTaxonomy(), managing taxonomies, and creating taxons. In the following example, you create a FlatTaxonomy:
var tax = manager.CreateTaxonomy<FlatTaxonomy>();
NOTE: The new taxonomy must have a name, title, root taxon name and description. The Name gets or sets the programmatic name of the taxon, whereas the Title gets or sets the display title of the taxonomy.
After setting the taxonomy properties, you create the first taxon and set its properties as well:
var taxon = manager.CreateTaxon<FlatTaxon>(Guid.NewGuid());
"This tag categorizes the Breakfast"
The taxon is added to the taxonomies taxa (taxon collection) via the taxonomy class helper method Add(Taxon taxon):
Finally, you call the SaveChanges(), so that a transaction with all the changes is created and run.
To find a taxonomy:
TaxonomyManager manager = TaxonomyManager.GetManager();
var taxonomy = manager.GetTaxonomies<FlatTaxonomy>().Where(t => t.Name ==
You can also get a taxonomy by ID using the GetTaxonomy(Guid id) method. Searching for a taxon or taxa is very similar to searching for a taxonomy:
var taxa = manager.GetTaxa<FlatTaxon>().Where(t => t.Name ==
Once you have the taxa or taxonomy instance, you can associate them with a content item.
Back To Top