Categories

Last Updated: Nov 9, 2021
documentation for the dotCMS Content Management System

Categories provide a taxonomy (a way of organizing content) which is selectable by content creators, but created and managed by administrators.

Usage

The main difference between categories and tags is that while tags allow content creators to create new labels at any time, category labels are pre-defined labels — created by site administrators — so content contributors can only choose from the list of terms provided by the category field(s) on a content type.

Category lists ensure that content contributors will only label content from a finite list of choices. For example, a “news” content type may have pre-defined news or industry sections. A Category field can be added to the news content type that only displays “National”, “International”, “Business”, “Sports”, and “Entertainment” as section choices, to ensure that all new News content is assigned to one of the existing sections.

Hierarchy

Categories are hierarchical; you may add sub-categories to any category, allowing you to organize large numbers of categories in a logical way, and allowing content creators to choose from among broader top-level categories to highly specific sub-categories at lower levels.

Selecting Categories

On a content type that has a category field, use the Click Here to Select Categories link to open up a modal window that allows categories to be chosen and added to the content being edited.

In the example image below, a News Item content type has a category field of “News Type”:

Select categories

In the category selection window, you may use the green + icon to the left of a category to add that category to the content, or click on the category name to display sub-categories add child categories to the content.

In the image below, the news item being added is being categorized as Press Release and “Product News” so that the dynamic news page can pull this content correctly on the news detail page(s)“:

Category fields

Administrators tend to prefer using category fields because they can be used reliably on dynamic pages to pull content whereas tags are difficult to predict and are not locked down to a fixed list as in the case with categories.

Best Practices

Although Categories are extremely useful, they do not make sense for all types of labels or content. Please consider the following best practices before adding a category field to a content type:

  • Initial Category lists should remain relatively short in length (30 labels or less).
    • Your category list is likely to grow as you scale and may become unwieldy if the number of categories is not limited.
  • Although you can have any number of hierarchy levels, in most cases it's recommended that you do not use more than 2 levels of categories.
    • It is difficult for content creators to find specific categories 3 or more levels deep.
  • Categories should be used for logical labels only.
    • If you need to label content with information that includes more than just a label (such as a Department, which might also include an address, phone number, manager, etc.), use a relationship to another content type instead.
  • Categories should not duplicate content.
    • If you already have content which is named with the same labels you need to use to label another content type, use a relationship between the content types instead of a category.
  • Note: Category fields always allow content creators to make multiple selections from the same category.
    • If you wish to create a field which allows only a single selection, consider a Selection field instead.

On this page

×

We Dig Feedback

Selected excerpt:

×