Page tree
Skip to end of metadata
Go to start of metadata

Inherited components are displayed on child pages automatically. Inheritance saves editors time and effort and it helps display content consistently across the site. For example, use inheritance for promotional content that changes often. When you update the content on the home page it updates everywhere in the page hierarchy.

Inheritance behavior

Inheritance behaves like this by default:

  • Editable in parent only: Inherited components can be edited only on the parent page. They don't have toolbars on child pages.
  • Order is inherited: Inherited components are displayed in the same order on parent and child pages.
  • Inherited first: Inherited components are displayed before non-inherited components in the same area. 

Inheritance properties

Configure component inheritance in an area definition. Simple example where all components are inherited:

areas:
  promos:
    renderType: freemarker
    type: list
    availableComponents: 
      text:
        id: my-module:components/text
    inheritance:
      enabled: true
      components: all
Node nameValue

 areas

 

 promos

 

 availableComponents

 

 text

 

 id

my-module:components/text

 inheritance

 

 components

all

 enabled

true

Properties:

enabled

optional, default is false

true enables component inheritance in the area.

components

optional, default is filtered

Defines which components are inherited to child pages.

Valid values:

  • all : Inherit all components.
  • filtered: Inherit only components where the Show in subpage box is checked in the component dialog.
  • none: Don't inherit any components.

properties

optional, default is all

Inherits area properties such as title and description to child pages. This is useful when you want to inherit just the area configuration, not its content.

Valid values:

  • all : All area properties are inherited.
  • none: No area properties are inherited.
nodeComparatorClass

optional, default is info.magnolia.rendering.template.configured.ConfiguredInheritance.NodeDepthComparator

Defines the order in which inherited components are displayed on the child page. The default NodeDepthComparator follows the order of nodes in the JCR repository. Nodes higher up in the hierarchy are displayed before nodes deeper down. Nodes on the same level are displayed as siblings. This means that inherited components are displayed in the same order on parent and child pages by default. You can implement a custom nodeComparatorClass to change the sort order. Set the property to a fully-qualified class name.

predicateClass

optional, default is info.magnolia.rendering.template.configured.FilteredInheritancePredicate

In Java, predicate is a functional interface that returns either true or false. Here we use a predicate to decide whether a component or property should be inherited or not. The default FilteredInheritancePredicate checks whether inheritance is enabled and how the components and properties are set, then it makes the decision. You can implement a custom predicate class that makes the decision based on some other variables. Set the property to a fully-qualified class name.

4 Comments

  1. Hi All,

    Can we inherit footer component of one template into another template?  We want to keep our footer constant through out the site. But templates are different for different pages. We are using EE pro 5.5 with magnolia Blossom integrated with Spring.

    Please advise.

     

  2. Hi Varshali. Apologies for the delay. You can do that with a Template prototype

  3. When rendering an area, is there a way to access the inherited components to decide which one should be rendered? Thanks in advance.