Extend Comments Component extend-comments-component

CAUTION
AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.

The intention of extending a default component is to alter the appearance or behavior of a component for specific uses.

The path to the component is unique and references the default component as a super resource type. There is less risk as the scope is limited compared to the global scope of a component overlay.

NOTE
Extending an overlaid component is not supported.

Example example

Suppose the header for the comment component must display with an alternate appearance on one site of the AEM instance, while appearing with the default display on another site. Instead of overlaying the default comment, which changes the comment component for all instances, a better solution is to ensure there are multiple comment components available for use on various sites.

To implement this solution, create a new component that extends (overrides) the existing one and modify the Handlebars script. The area of the site that uses the new comments can use the extended one, while the sites that use the default appearance remain unaffected.

The comment component is actually one of two components which comprise the comment system. Thus, there are two components to extend: comments and comment. The script to edit is in the *comment *component’s header.hbs file, while the parent comments component (the comment system) is what an author actually adds to the page.

To extend comments you will need to:

recommendation-more-help
5d37d7b0-a330-461b-814d-068612705ff6