Skip to content

How to add categories and category groups

Add categories

Go to the Sanity Studio, click the Category Management button, and then click the + button.

Input the category name, and generate the slug, set the description and priority, then click the Publish button.

Add Categories

After the category is published, you can see the category list in the website like this.

Category List

Add category groups

Go to the Sanity Studio, click the Group Management button, and then click the + button.

Input the group name, and generate the slug, set the description and priority, then click the Publish button.

Add Category Groups

After the group is published, you can see the group list in the website like this.

Group List

The category group is supported by default, if you do not want to show the group, you can disable it by setting the SUPPORT_CATEGORY_GROUP to false in the src/lib/constants.ts file.

// support category group, default is true (aka, show category group)
// NOTE: if you set true, you should make sure each category belongs to a group
// if you set false, the category will be shown in the root level
export const SUPPORT_CATEGORY_GROUP = false;