Extend Comments Component extend-comments-component

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.

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 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 must: