Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
...
Before Magnolia 5.4, the only way to define (configure) templates, dialogs, apps and other definition items was only through JCR in the configuration
workspace. The Magnolia 5.4 release brought 4 brought configuration via YAML as another possibility, mainly because:
...
With the release of Magnolia 5.5.4, importing and exporting JCR data can be done with YAML files. Until then this was possible only in the XML format.
...
Item | YAML file | Corresponding definition class* | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dialog | myDialog.yaml |
| ||||||||||
Template | myTemplate.yaml |
| ||||||||||
App | myApp.yaml |
|
* You can also use custom definition classes which will usually extend the classes mentioned above. In this case you have to provide the class as an attribute in the YAML file.
!metadata
The introduction of the info.magnolia.config.source.yaml.construct.WrapMetadata
construct in Magnolia 5.6.2 allows you to deprecate YAML-based definitions. You can mark a YAML-based definition as deprecated like this:
Code Block | ||
---|---|---|
| ||
deprecated: !metadata
since: 5.5.6
description: The dialog uses the deprecated PlaceholderTextFieldDefinition. Please use the placeholder property instead. |
The deprecated definition is displayed in the Definitions app. Currently, the app reports the following deprecated (or non-existing) items:
!inherit
and !include
Magnolia provides two mechanisms to reuse a configuration within a YAML-file: !inhertinherit
and !include
. You can use them not only to reuse a definition but also to modify a reused definition.
inherit
( Magnolia 5.5.6+)
Use the Magnolia !inherit
directive to inherit a registered definition item in order to create a new definition item, and then modify the new item according to your needs. This directive is very similar to JCR extends. The item you inherit the definition from is referenced by its identifier.
...
For more information read the YAML inherit and include page.
include
Use the Magnolia !include
directive to add a reusable YAML chunk. Include a fragment on a sub-level of your new definition or include a complete definition on top of your new definition. Reference the file you include by its resource path. The path to such a resource has the following pattern: /<module-name>/path/to/the/reusable/chunk.yaml
.
As of Magnolia 5.5.6+ you You can also modify the included part of the definition.
Tip |
---|
If your |
Syntactic variants of the directive
...