Basics

In Contentful there are multiple ways to create categories. If you’d like your categories available from the Content Delivery API to be used in your client applications, we recommend using either short text fields or reference fields. If you’d like to categorize content for better organization in the Contentful web app, we recommend using our Tags feature. You can read more about Tags here.

For categories that will be available in the delivery API, you can use short text fields or using Reference fields to other entries.

Short text fields

This comes in handy when you want to assign specific categories without metadata - tags for example. Short texts are relatively small tokens of text that only make sense unbroken and can only be searched for as a whole element (contrary to the text fields, whose text can be searched in parts). For instance, if you use the short text Vegetarian as a category, you won't find your Vegetarian entries when you search for 'Veg'. Categories as short texts require special attention, since several names can be assigned to the same object or concept.

Reference fields

Other entries can be used as categories with metadata. This means that you would assign not only the name as a category, but also other information within the determinate entry itself. To use a reference a category, you have first to create the entry that will serve as the category.

Let's say you will have a Book entry that needs an author. You would create the Author entry with a Name (text field), a short Biography (text field) and a Picture (media). These other fields are the metadata of your category. You would then create a Book entry that would reference the Author entry. Now you have a category (Book) with one entry (Author). It's that easy!

There are the following statuses of the field's lifecycle:

  • Hide field when editing Select this status to hide the field from the entry editor. The field and its content remain present in the API response, but not visible in the entry. This status can be used to hide specific fields from editors.

NOTE: A user still has an option to show a hidden field and edit its content in the entry editor. To restrict a user from editing the hidden field, configure the user's space role accordingly — for example, add a deny rule preventing the user from editing this field.

  • Omit from API response Select this status to disable the field completely. When a field is disabled in response, it isn't possible to fetch its content via the Content Delivery API or the Content Preview API. This status can be used for fields that contain management-related data but have no actual content to be delivered.

  • Delete Select this status to completely remove the field from your content type. If there are entries connected to this content type, they will loose the content of this field forever.

NOTE: To delete active fields — those that are currently being used — you must first disable them from the response.

Instead of choosing image dimensions in Content Management you can specify the dimensions of images during delivery. Images are hosted on images.contentful.com. For files on this host you can attach several URI query parameters to specify the desired dimensions, crop and even focus. The image will never be stretched, skewed or enlarged but rather fit into the bounding box given by the w and h parameters.

Width and height

By adding a width and a height parameters, the image always scales accordingly and is never deformed even if the parameters passed do not correspond to the ratio of the image.

Images API request parameters: Width & Height

Fit

To change the way your image responds to the w and h parameters, attach the fit parameter to the asset’s url.

Images API request parameters: Fit

Focus

The focus parameter determines where the fit parameter should focus on. It takes values such as right, left, top and bottom, or combines them like bottom_left or top_right. You can also choose to focus on faces. However, the parameter aces only works with fit=thumbfit=fillfit=lfill and fit=crop.

Images API request parameters: Focus

Radius

The radius parameter adds rounded corners to your image. The higher the value, the more enclosed in a circle your image will be.

Images API request parameters: Radius

Additionally, a q can be passed to define the JPEG compression quality between 1 and 100 and the fm parameter can be used to change the format to either "png" or "jpg".

See also: Images API documentation

You can set predefined values for your content creators to choose from using Short Text fields and selecting the 'Predefined values' validation.

Adding and ordering values

To add several values, insert the value in the text input and press Enter. The more values you add, the more rows will appear. To order the values previously inserted, just drag and drop them to the right order. The order you add to the validations will influence the order in which these are displayed on the Entry editor.

How do I create a dropdrown menu?

First create a regular 'Short Text' field (not type 'List), add your predefined values, then navigate to the 'Appearance' settings and select 'Dropdown'.

To delete an organization you manage or delete your account, please contact support.

When working with fields containing multiple references, you might benefit from a reference editor. The editor streamlines the task of creating, editing and publishing related entries by displaying them all in a single view. To activate the editor, in the Content Model section, open the field settings, navigate to the Appearance tab and select the "Use bulk editing" checkbox. Now save the changes and you can start using the feature.