Add or remove synonyms to tags

When you add synonyms to a tag, you can filter your content items by the tag name or by the tag synonyms. You can, as well, to add or delete synonyms programmatically.
For more information about adding tags via code, see Add and remove taxonomies: Add tags.

You can add tag synonyms in the code-behind of web form, in a custom widget, and so on.

Add synonyms

To add a new synonym:

  1. Use TaxonomyManager which is the manager class for taxonomies.
  2. Get the specific taxon with name Test.
  3. Create a new synonym of type Synonym.
  4. Define the parent and the value of the synonym created.
  5. Call the manager’s SaveChanges method to persist the changes to the database.

Following is an example of the code:

Remove synonyms

To remove a synonym:

  1. Use TaxonomyManager which is the manager class for taxonomies.
  2. Lookup the synonym by value.
  3. Call the manager class Delete method.
  4. Call the manager class SaveChanges method to persist the changes to the database.

Following is an example of the code:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?