Content types
The Magnolia Content Types module is a tool to define the content model in Magnolia.
See the Content Types module page for more on the module itself. |
Content models are a key consideration for every web and digital experience project you work on. It creates a shared understanding across the domains of a project, from project owners and marketing leads to content creators to developers.
It describes the key types of content in your project, the properties each of those types has and the relationships between the content types.
Use content types to easily create content apps. |
Rapid development and deployment
Reduce your time to market with Magnolia content types by reducing development time and increasing deployments to production.
Once the content apps are in place, editors can start entering content right away. They can do so in parallel with or even before the rest of the project/template development.
Single file configuration
Developers configure all required definitions for a content type in a single YAML file within a light module. The YAML file contains both the content model and the details about where to store the data (datasource
) such as a workspace
.
datasource: (1)
workspace: tourguides
namespaces:
mt: https://www.magnolia-travel.com/jcr/1.0/mt
autoCreate: true
model: (2)
nodeType: mt:tourGuide
properties: (3)
- name: birthday
type: Date
- name: gender
- name: shortBio
1 | datasource required Defines the data source. |
2 | model required Defines the model of the content type. |
3 | name optional The value of the name property under properties: is automatically assigned by the name of the resource which defines the content type (such as a YAML file name without the suffix). Here, you can set the property in the content definition to override the automatically assigned value. |
Content type property suffixes
When you define a content type property, you should avoid using a 2-letter suffix. This is because Magnolia reads the suffix as a language such as property_en
or property_de
.
If you add a 2-letter suffix, the property is not delivered when using the Delivery API. |
datasource:
$type: jcrContentTypeDatasource
workspace: tourguides
namespaces:
mt: https://www.magnolia-travel.com/jcr/1.0/mt
autoCreate: true
model:
nodeType: mt:tourGuide
properties:
- name: description (1)
type: String
i18n: true
...
- name: description_ins (2)
type: String
i18n: true
...
- name: description_in (3)
type: String
i18n: true
1 | A correct property name with no suffix. |
2 | A correct property name with an acceptable suffix. |
3 | An incorrect property name with the 2-letter suffix. |
Automatically generated apps
Creating, editing, publishing, managing and deleting content items of a content type works best with a content app. The content types module automatically generates this app for you based on the content type definition. All you have to do is to provide a minimalistic app definition file referencing the content type definition.
!content-type:tourGuide
name: tourGuides-app
Quick deployment
Use light modules to deploy new content types and apps to your production environment without redeploying a WAR file or restarting Magnolia.
Convention over configuration
The Content Types module facilitates the development process by following the convention over configuration principle.
With minimal configuration, you can achieve excellent results which follow Magnolia’s best practices based on typical use cases. Nevertheless, you can also map highly complex and sophisticated use cases with content types.
Content modeling
With a content type, you can define structured data in a very straightforward way. Such a definition can be kept simple just by configuring a list of plain properties, but it can also go far beyond this:
-
Define relations between different content models
-
Link one or more content items of type A to a content item of type B.
When you need a group of fields more than once in the same model, use submodels. This allows you to define relations to content items which you created before the Content Types module was available. |
Default configuration
Defining a content app has never been quicker than with referencing a content type. You can do it with one line of a YAML file.
Magnolia generates a ready-to-use app with simple or complex form fields depending on the type of the properties of the given content type.
For more on fields, see form fields. |
To satisfy any custom requirements of your content editors, the defaults of the generated app can be overridden on different levels. |
Content types and headless projects
Combining Content Types with the Delivery API makes it a perfect match for headless projects.