Component autogeneration

Autogeneration creates components inside an area automatically without editor involvement. Anything you define under the content node will be autogenerated.

Autogeneration behavior

Autogenerated components behave differently from normal components:

  • Ordered as defined: In an empty area, components are autogenerated in the same order as they are defined in the area definition.

  • New components are placed last: If an area already has autogenerated components, newly defined components will be placed last.

  • Cannot delete permanently: When you delete an autogenerated component, it is regenerated and placed last in the area.

Autogeneration properties

Configure component autogeneration in an area definition under the autoGeneration node.

Example definition
areas:
  footer:
    renderType: freemarker
    type: single
    autoGeneration:
      content:
        quotation:
          nodeType: mgnl:component
          templateId: my-module:components/quotation
          quotationText: <p>Carpe diem.</p>
          citedPerson: Horace
          references:
            class: java.util.ArrayList
            0: Hesperides1648
            1: Marvell1681
            2: Frost1938
      generatorClass: info.magnolia.rendering.generator.CopyGenerator
Properties under autoGeneration
Property Description

content

required

Parent node for autogenerated content. Anything you define under this node will be autogenerated. To create multi-value properties, see the references property in the example definition above.

     <component name>

required

Name of the autogenerated component.

         nodeType

required

When set to mgnl:component, defines the referenced item as a component and generates a component node.

         templateId

required

Component ID in <module>:<path> format that references a component definition.

generatorClass

required, default is info.magnolia.rendering.generator.CopyGenerator

Class that generates nodes based on the definition. The default info.magnolia.rendering.generator.CopyGenerator creates a copy of the exact nodes and properties you define under the content node. To create a custom generator class, make sure you implement the info.magnolia.rendering.generator.Generator interface.

Component autogeneration in SPA

See Component autogeneration in the Headless Docs section.

For this usage, the endpoint must be configured with $type: jcrPagesDeliveryEndpoint_v2.
Feedback

DX Core

×

Location

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