CMS

Reference Component in AEM

Introduction

Any web page built using AEM consists of a bunch of components. Some of these components are used on need basis, whereas some components such as header, footer, navigation etc. provide the basic structure of the page. These are often logically categorized as structure components.

An important thing to consider while implementing structure components is that an author should need to author them only once for entire website. Rest of the pages should be able to fetch the structure components from the index page/home page directly. Any changes done to the structure components within index page/home page should be cascaded & reflected in the child pages automatically.

 

Implementing structure components using Reference component

There are many ways to implement structure components (header, footer, navigation etc.) within an AEM website. One of the ways is to use reference component.

Reference component as the name suggests takes the reference/content from the parent page & makes it available to the child page. What this means in terms of header & footer is that a content author needs to author the header/footer on root level page template only & this reference component will fetch the content of these authored header/footer from parent & will display it on the child page.

 

Code Snippet for Reference component

Reference-component.html

ReferenceServiceModel.java

 

About The Author