Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.

Use the Magnolia Content type definition to specify a content type.

A Magnolia content type is a formal definition for a type of content in Magnolia including the properties the type may contain and its relationships to other types of content. A content type is configured in a content type definition that includes the data source definition and the model definition.

Content type items can be managed by a content app. The content can be embedded into web pages or served via REST in a headless approach.

The base interfaces for content type definition are agnostic of data source type. However, the magnolia-content-types module provides also specific definition classes for JCR data to define custom JCR workspaces, node types, and namespaces.

The definition item can be supplied via any Magnolia Resource origin. You can create them in a light module, in a Magnolia Maven module or in the JCR configuration workspace (see Location of the content type definitions).  New content type definition items are detected by the  magnolia-content-types  module and registered at the  ContentTypeRegistry  using the name of the definition as the ID.


Example configuration:

  workspace: tourguides
  autoCreate: true
  nodeType: mt:tourGuide
    - name: birthday
      type: Date
    - name: gender
    - name: shortBio
Here we only focus on the top level properties of the content type definition.



Defines the data source. Please read Content type Data source definition for further information.



Defines the model of the content type. Please read the Content type Model definition for further information.



The value of the name property is automatically assigned by the name of the resource which defines the content type (YAML file name without the suffix or JCR node name).

Set the property in the content definition to override the automatically assigned value.

Location of content type definitions

The definition item can be supplied via any Magnolia Resource origin. You can create them in a light module, in a Magnolia Maven module or in the JCR configuration workspace.

Add the configuration to the /<module-name>/contentTypes folder.

└── contentTypes
    └── my-content-type.yaml

Name of the definition: my-content-type

Add the configuration to the resources/<module-name>/contentTypes folder.

└── src
    └── main
        └── resources
            └── my-maven-module
                └── contentTypes
                    └── larrys-content-type.yaml

Name of the definition: larrys-content-type

Add the configuration to the /modules/<module-name>/contentTypes folder.

Node name





Name of the definition: boat-content-type

Interface and class

The base interface for a content type definition is ContentTypeDefinition. The base implementation class is ConfiguredContentTypeDefinition.