Limiting no. of categories tagged to a webcontent

What is the problem you are trying to solve?

Currently Liferay has 2 options while creating a vocabulary, it can be multiselect and it can be required.

Can we add another option to provide limit for a vocabulary, for eg. maximum 5 of the categories from vocabulary can be assigned to a web content. Different vocabulary can have different limits.

What is your project about? (e. g. Intranet, Partner Portal, Enterprise Website, etc)

Enterprise website

This would definitely be a valuable enhancement for enterprise content management use cases.

Currently, I don’t think Liferay provides an out-of-the-box option to restrict the maximum number of categories that can be selected from a specific vocabulary. However, this can still be achieved through customization.

In one of our implementations, we handled a similar requirement by overriding the related fragment and adding a custom configuration to define limits per vocabulary.

For example:

  • “Topics” vocabulary → maximum 5 categories

  • “Regions” vocabulary → maximum 2 categories

The validation provides immediate feedback to content authors whenever the configured limit is exceeded.