Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Overlay vs Extend

Avatar

Level 5

Is there any advantage to overlaying components than just extending them using sling:resourceSuperType?

Overlay allows you to copy over libs components to apps and changing them without affecting the original component. Doesn't extending the component also allow the same - you can just overwrite the script where changes are required? In addition, extending can make it future-proof, that is, if you happen to upgrade AEM in the future, extending components will allow you to use the latest available components in /libs.

Or is there anything that can only be achieved using overlay that I'm missing here?

Thanks for any inputs here.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

I basically prefer extending a component in AEM because, if you extend the component and setting the property sling:resourceSuperType to the particular path of the component and you can modify the component according to your project requirements.

Also - Once you upgrade your AEM to higher version, you can inherit the features of existing component from OOTB and you no need to manually make the changes.

'

And Overlays - Here you can copy the component from OOTB to your apps and make changes according to your project requirements. Here when you upgrade to higher version of AEM, you need to manually apply the changes(No inheritance from OOTB).

Here is the nice explanation as Scott provided: cq5 - overlay/overriding v/s extending of components in AEM - Stack Overflow

Hope this helps!!

Thanks,

Ratna Kumar.

View solution in original post

3 Replies

Avatar

Level 10

That is a good question. When you want to modify a component - the typical way is to use Overlay - as described here: Overlays

Also a very good answer here too: cq5 - overlay/overriding v/s extending of components in AEM - Stack Overflow

Avatar

Correct answer by
Community Advisor

Hi,

I basically prefer extending a component in AEM because, if you extend the component and setting the property sling:resourceSuperType to the particular path of the component and you can modify the component according to your project requirements.

Also - Once you upgrade your AEM to higher version, you can inherit the features of existing component from OOTB and you no need to manually make the changes.

'

And Overlays - Here you can copy the component from OOTB to your apps and make changes according to your project requirements. Here when you upgrade to higher version of AEM, you need to manually apply the changes(No inheritance from OOTB).

Here is the nice explanation as Scott provided: cq5 - overlay/overriding v/s extending of components in AEM - Stack Overflow

Hope this helps!!

Thanks,

Ratna Kumar.