Content type definition
A content type definition is the technical declaration of a content type. It specifies a namespace (a prefix that keeps names from clashing), a name, properties (the fields) and options that apply to the content items based on that type. In Jahia, it is written with a dedicated syntax, in a text file with the .cnd extension, delivered in a module.
Definition and how it works
For a project team, the definition is a contract. It sets what contributors will be able to enter, which fields are mandatory, which are translatable and what an application will be able to read through the API. Jahia also generates the Content Editor form from it, so no entry screen is designed by hand. A change to the definition therefore affects entry, display and the API.
In practice, a type is declared on one line as [namespace:name] and inherits from the base type jnt:content, taking on its common features. Adding the jmix:editorialContent mixin (a mixin being a set of properties grafted onto a type) makes it available to contributors. Each property has a name and a value type (text, yes/no boolean, date, number, reference to another content item) and can carry attributes (mandatory, translatable or primary), the last one designating the property used as the displayable name. Mixins group reusable properties, which appear as fieldsets in the form.
Academy documentation: creating a content type
Related terms: Content Type · Property (content) · Content item · Displayable Name · Content Editor · Field
Resources that cover this term
Content type definition vs content type: the differences
A definition differs from the content type (the model it describes) and from the files that adjust how the form looks.
| Term | How it differs |
|---|---|
| Content type | The content type is the business model (a job offer, a product). The definition is its technical expression in the .cnd file. |
| Form layout (JSON) | JSON files delivered in a module adjust the form: order, labels, help text, sections. They modify fields declared in the definition but cannot create new ones. |
| Property (content) | A property is one line of the definition: a named attribute with its value type and constraints. |
Content type definition in practice
Before delivering a new "News" type, the integrator (the team that builds the site) shares the planned property list with the editorial team: title (mandatory, translatable), summary, image, date, author. The team points out that a "Topic" field is missing for filtering lists and that the author does not need translating. Fixing this at this stage takes minutes.
This review prevents the most expensive case, which is finding out after go-live that an essential field is missing or that a field was not declared translatable.
Frequently asked questions
Does changing a content type definition require a deployment?
A change to a definition goes through a new module version, since definitions are delivered in modules deployed on the platform. It then affects the editing form, the views and the API. For content that has already been entered, a structural change should be prepared with the integrator to check its effect on existing items.
Why are type definitions stored in a text file in the module?
The definition is part of the project’s code. Stored in a module, it is versioned, reviewed and deployed along with the views and the rest of the code, from one environment to the next. Contributors only see the result, an automatically generated form. The CND (Compact Namespace and Node Type Definition) notation is also defined by the JCR 2.0 specification (JSR 283, 2009) Jahia is built on.
Who should review a definition before it is developed?
The integrator writes it, but the editorial team benefits from reviewing the planned field list (names, mandatory status, translation, expected values). Digital managers, for their part, check what lists, search and the API will need to use. A cross-review during scoping costs little and avoids rework after go-live.