Component definition

Light developers can use the create-component command in the Magnolia CLI to create page templates.

A component is the smallest block of content that editors can edit, delete and move as a single unit on the page. A component definition is similar to a page definition and uses the same definition object. You can configure a template in a YAML file or a JCR node.

At its simplest, a component may be just text. However, a component can contain almost anything: a related image, a list of links or a teaser to another page. Components render content entered by editors in dialogs.

Component properties

Simple example definition:

renderType: freemarker
templateScript: /my-module/templates/components/text.ftl
dialog: my-module:components/text
modelClass: com.example.templates.TextComponentModel
deletable: false
moveable: false
personalizable: false
class: com.example.templates.TextComponentDefinition

You can use common template properties and the following properties in a component definition:

Property Description


optional, default is true

Determines if component can be deleted. Set to false to prevent editors deleting the component.


optional, default is true

Escapes any HTML code entered into the component if the component contains an input field. This is a security feature that prevents XSS attacks. Default is true for all form fields except password where default is false.


optional (DX Core only)

Allows you to mark a component as dynamic. See Advanced Cache Dynamic Page Caching and SiteMesh module.


  • class: info.magnolia.module.advancedcache.rendering.DynamicFragmentDefinition supports an advanced definition for dynamic fragments.

  • cacheKeyGeneratorClass: Cache key generator class. Default is null.

  • dynamic: Enables and disables dynamic caching. default is true.

  • mechanism: Mechanism used. Sitemesh mechanism is supported. Default is null.

  • ttl: Time to live setting. Default is 0.


optional, default is true

Determines if component can be moved. Set to false to prevent editors moving the component.


optional (DX Core), default is true

Determines if component can be personalized. Set to false to prevent editors personalizing the component.


optional, default is true

Determines if component can be edited. Set to false to prevent editors editing the component.

Location of component definitions

Put your component definitions here:

  • YAML file: $magnolia.home/<module-name>/templates/components

  • JCR node: /modules/<module-name>/templates/components

Component templates can be provided by more than one module, and you can configure new component definitions in existing modules.

Component availability

Component availability is configured in an area definition. The area can then be used on many page definitions.

Configure a content map of components in each area definition using the id property to link to the component definition.

Nested components

You can create composite components with nested subcomponents. The nested components are configured under an areas item or node. This part of the configuration follows the same pattern as an area definition.

Example: Two link components inside a composite link list component.

renderType: freemarker
templateScript: /my-module/components/linkList.ftl
dialog: my-module:components/compositeLink
title: components.compositeLink.title
description: components.compositeLink.description
    type: list
    templateScript: /my-module/components/linkList.ftl
    title: components.compositeLink.title
        id: my-module:components/internalLink
        id: my-module:components/externalLink

Nodes and properties:

<component name>


Marks the configuration as an area.

         <area name>


Components available in the area.

                 <component name>

Map of nested components available in the area.


Component definition ID in <module-name>:<path to component definition> format.

             <area properties>

All properties available in list and single area definitions can be used.

     <component properties>

All properties available in component definitions can be used.


DX Core



This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules
6.3 beta

Magnolia 6.3 beta

Magnolia 6.3 is in beta. We are updating docs based on development and feedback. Consider the 6.3 docs currently in a state of progress and not final.

We are working on some 6.3-beta known issues during this phase.