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:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?