Magnolia 6.0 reached end of life on June 26, 2019. This branch is no longer supported, see End-of-life policy.
DEVELOPER PREVIEW
Use the Magnolia Content type definition to specify a content type.
The Magnolia Content Types module is currently available as a Developer Preview. The full version is still under development.
This developer preview brings several powerful features. Please try it out and feel free to send us your feedback and suggestions based on your experience.
We are working to finalize the module as soon as possible.
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.
Follow the Content Types tutorial to learn how to use Magnolia content types, create content type definitions and corresponding apps.
Example configuration:
datasource: workspace: tourguides namespaces: mt: https://www.magnolia-travel.com/jcr/1.0/mt autoCreate: true model: nodeType: mt:tourGuide properties: - name: birthday type: Date - name: gender - name: shortBio
datasource | required Defines the data source. Please read Content type Data source definition for further information. |
model | required Defines the model of the content type. Please read the Content type Model definition for further information. |
name | optional 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. |
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.
my-light-module/ └── contentTypes └── my-content-type.yaml
Name of the definition: my-content-type
Add the configuration to the resources/<module-name>/contentTypes
folder.
my-maven-module/ └── 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 |
---|
modules |
my-custom-module |
contentTypes |
boat-content-type |
Name of the definition: boat-content-type
The base interface for a content type definition is ContentTypeDefinition. The base implementation class is ConfiguredContentTypeDefinition.
2 Comments
Tomáš Gregovský
example of using mgnl namespace:
Christoph Meier
Which is also showed on the subpage Content type Data source definition