A content type is a template that defines the data structure, functionality, and behavior for all content items that are based on it. When creating content types, you determine their:
AI-assisted content modeling
Use KentiCopilot to prototype and validate your content model with AI. See Prototype your model with Content modeling MCP server and Content Modeling MCP server. For retrieval and management of content types, see Management MCP server.
If you are starting from an existing design, the design-to-content skill in the web development plugin (opens in a new tab) derives a whole model from a design, wireframe, or Figma file, including the reusable field schemas, taxonomies, and content relationships the design implies.
To create a new content type:
Namespace – the namespace is a prefix that distinguishes between content types. For example, it can be used to separate content types created for different sites, identify content types imported as part of third-party modules, etc.
Name – a unique content type identifier, which is appended to the namespace.
Important
When creating content types, never use names beginning with an underscore ('_') character (e.g., '_article') to avoid conflicts with system fields.
Always use a unique namespace. Never use the cms, om, content or ContentItemData prefixes. A recommended option is to use your company name or an abbreviation as the prefix. For example: ACME
The system creates the content type and opens its configuration menu.
When configuring content types, you determine their functionality and purpose.
You can:
Content type fields are used to store structured data. Each field corresponds to a database column and is of a certain data type. Developers access the content of fields from the code to format and display stored data.
Fields that use custom data types are not supported by the GraphQL API for headless channels and their values cannot be retrieved. Only built-in scalar types are available in content types exposed through the API. See Retrieve headless content to learn more about what is included in the GraphQL schema.
You can create content type fields via the field editor on the Fields tab when editing a content type in the Content types application:
Content items based on this content type now allow editors to input data into the added fields.
Since each field is represented as a database column and potentially a C# class, adhere to the following restrictions when naming fields:
If you migrate content types from an older Kentico version and the migrated content types contain fields with restricted names (for example, Asset), rename these fields after migration to ensure full compatibility with Xperience by Kentico.
Not following these recommendations can result in unexpected behavior, runtime errors, or uncompilable code.
You can enable users to link content items from other reusable content items.
Now, whenever users edit a content item based on the content type, they can link content items of allowed content types. You can then retrieve and use the linked items in your application's code.
Linked item limitations for emails
Linked content items may have their own fields that link to further content items.
When modeling the fields of content types for emails, the system has a limit of 5 nested content item levels. Further levels of linked items will not be loaded into the final email content.
You can enable users to upload binary files to content items of a certain content type to create content item assets. You can also configure the parameters of the file upload (e.g., maximum file size).
Now, whenever users edit a content item based on the content type, they can upload binary files to the item to create a content item asset. You can then retrieve and use the assets in your application's code.
You can allow users to upload multiple files in a single bulk into the Content hub, combined content selector, or rich text editor, and automatically convert them to content item assets of a specific content type. The system only supports converting all mass-uploaded files to a single content type.
Users can now mass upload assets into the Content hub, combined content selector, and rich text editor.
You can enable content editors to add tags to pages and reusable content items.
Now, whenever you edit a content item based on the content type, you are able to add tags to the content.
Tip: You can add multiple taxonomy fields to a single content type, each with a different set of tags.
You can enable AIRA features for eligible fields to simplify editors' work when creating content. See AIRA configuration for more information.
To ensure that your content editors work with images that are properly optimized for use across different channels, you can configure the system to automatically convert all newly created images to a single image format, and optimize their file size by adjusting image quality or image dimensions. While the system retains the original version of the image in case of a future re-optimization, the original version is not accessible from the administration interface.
In the Content types application, select the content type for which you want to enable automatic image optimization.
In the Content item asset field, select Enable automatic image format conversion.
Select Image extensions to convert. You can choose only optimizable image types that are allowed for the particular content type.
Select a single Output image extension for the converted images. If you are not sure which image format to use for the content item asset, see the Image file type and format (opens in a new tab) guide.
Select the Quality level of the converted images.
(Optional) In the Image width limit and Image height limit fields, you can set the maximum dimensions of the converted image. Images exceeding the set width or height limit are automatically resized to fit upon upload.
Setting a very low image width or height limit can result in poor-quality image variants , as they will be generated from the downsized version of the original image. Make sure the limit is high enough to maintain visual quality across all variants.
Save the field.
Upon upload, images with the selected Image extensions to convert are automatically converted to images with the Output image extension in the specified Quality. Images with other extensions are uploaded without any optimization.
We recommend manually optimizing several sample images before enabling automatic optimization to fine-tune the optimization parameters for the best results.
If you notice undesired compression artifacts (opens in a new tab) in the converted images, try increasing the quality until the artifacts are no longer visible.
Image variants are cropped and resized versions of an image, each defined by a specific aspect ratio and pixel dimensions. Variants allow marketers to control how images appear across different contexts, such as hero banners, social media posts, or thumbnails, and help developers address the art direction (opens in a new tab) and resolution switching (opens in a new tab) problem.
Image variants are generated from the primary optimized image, taking into account its format and quality. The usage of image variants is currently supported only for website channels.
You can add two types of image variant definitions:
Scaled variant – Image dimensions are resized based on input while maintaining the original aspect ratio. If one dimension is set to 0, the system automatically calculates that dimension proportionally to preserve the aspect ratio. For example:
Smart crop variant – Images are cropped based on the focal point. Marketers can fine-tune the smart crop variants by selecting a focal point to guide automatic cropping or by adjusting the crop manually. To ensure the image meets the specified dimensions, the system may upscale or downscale the final variant as needed.
The maximum supported number of image variant definitions is 63. Exceeding this limit may result in unexpected behavior.
When using Scaled variants, images can be scaled up if the specified dimensions exceed the original image dimensions. This may result in blurry images or increased file sizes due to image upscaling. Developers who need to avoid upscaling should handle this behavior within their implementation.
To define a new variant for images in the system:
All images in the system become available in the defined variant shortly, after the automatically triggered Update asset variants system scheduled task completes. Users can then further manage individual variants of their images.
Marketers typically won’t use every variant of every image. To prevent unnecessary storage use, the binary file for each variant is generated only when the variant is accessed for the first time.
Variants accessed for the first time while the application runs in read-only mode are generated into a temporary local cache instead. See Read-only deployments.
To correctly display image variants on the pages of a website channel, developers can either:
kxp-img, kxp-img-dimensions and kxp-img-variant attribute Tag Helpers to render the image variant in your views. For more information on Tag Helper usage, see Reference - Tag Helpers.
@*
- kxp-img – Renders markup of the `src` or `srcset` attributes with
the image URL as their value. Accepts a ContentItemAsset object representing the image.
- kxp-img-dimensions – Renders markup of the `width` and `height`
attributes based on the dimensions of the image variant.
- kxp-img-variant – Specifies the code name of the image variant to be used.
*@
@addTagHelper Kentico.Content.Web.Mvc.ContentItemAssetImageTagHelper, Kentico.Content.Web.Mvc.ContentItemAssetPictureSourceTagHelper, Kentico.Content.Web.Mvc
@* Works well with both scaled and smart crop image variants *@
<img kxp-img="@Model.ContentItemAsset" kxp-img-dimensions kxp-img-variant="variantCodeName" ... />
@* Best used with smart-crop variants to address art direction scenarios *@
<picture>
<source media="(min-width: 1024px)" kxp-img="@Model.ContentItemAsset" kxp-img-dimensions kxp-img-variant="variantCodeName1" ... />
<source media="(min-width: 600px)" kxp-img="@Model.ContentItemAsset" kxp-img-dimensions kxp-img-variant="variantCodeName2" ... />
<img kxp-img="@Model.ContentItemAsset" kxp-img-dimensions ... />
</picture>using CMS.ContentEngine;
// Retrieves a content item asset
// ...
// Accesses the asset object in the ImageFile property of the asset's content type
ContentItemAsset asset = myAsset.ImageFile;
// Accesses the properties of an image variant with the 'Hero' code name
if (asset.Metadata.Variants.ContainsKey("Hero")){
int variantWidth = asset.Metadata.Variants["Hero"].Width;
int variantHeight = asset.Metadata.Variants["Hero"].Height;
string variantType = asset.metadata.Variants["Hero"].TransformationType;
string variantUrl = asset.VariantUrls["Hero"];
}Image variant URLs build on top of the standard base asset URL by inserting the variant's code name into the path and appending it to the file name. This means that a base URL like:
/getContentAsset/7dd94187-f658-48cd-8a59-308e55b154f1/cc721195-df8f-4799-b974-5ade63036cab/the-resilient-robusta.webp
turns into the following for a variant called MyImageVariant-Wide:
/getContentAsset/7dd94187-f658-48cd-8a59-308e55b154f1/cc721195-df8f-4799-b974-5ade63036cab/MyImageVariant-Wide/the-resilient-robusta_MyImageVariant-Wide.webp
In general, every variant URL follows this structure: /getContentAsset/<content-item-guid>/<asset-field-guid>/<variant-code-name>/<file-name_variant-code-name>.<file-extension>, where each segment represents:
content-item-guid – the GUID of the content item that the asset is attached to.asset-field-guid – the GUID of the Content item asset field storing the asset.variant-code-name – the code name of the image variant (e.g., MyImageVariant-Wide).file-name_variant-code-name.file-extension – the original file name with the variant code name appended as a suffix (e.g., image_MyImageVariant-Wide.jpg derived from a source file named image.jpg).To edit an image variant's definition:
The image variant is updated accordingly to its new definition in all images after the automatically triggered Update asset variants system scheduled task completes.
If a specific image variant should no longer be used in your project, you can remove its definition:
After the image variant's definition is deleted, the variant itself remains visible when adjusting images but becomes read-only. Your developers should now update their code to no longer use the deleted variant.
The system provides code generation support for objects that contain custom fields. The resulting generated classes are plain data transfer objects that work seamlessly with Xperience's data retrieval API.
Whenever you modify a content type's fields (add or remove fields, change the field's data type), you need to regenerate the corresponding classes using the code generator. This keeps the models consistent with the content type's database definition.