In this session, let us summarize what we learned in the previous session: Create the first template. We created a template in three steps:
- Step 1: Created the company folder inside apps. Created a folder for components and templates.
- Step 2: Created a template inside the templates folder. Provided allowed paths as /content(/.*)?. And, we provided resourseType as aem-company/components/homepage. This was a component that didn’t exist at that time.
- Step 3: We created a homepage component inside the components folder. This is the component that has the rendering script which decides the layout of the page. We named it as homepage, so that we can identify it as a page component (a component that decides the layout of the page, not the component you drag and drop to a web page.) We specified resourceSuperType of this component as wcm/foundation/components/page. Our intention was to inherit the page component. This is a must to get various functionalities in the webpage that authors create. We renamed the default script of component as body.html, so that we override only body.html that existed in wcm/foundation/components/page. Rest of the scripts we inherited.
This is the standard process to create a template. I have created a package (FirstTemplate.zip) and shared in my GutHub account. Feel free to download, install, and experiment with it. You need to log into PackageManager to install a package. Packages in AEM helps you to share codes across AEM instances.
- Download the package from GitHub. Use FirstTemplate.zip.
- Log into PackageManager as admin/admin. (http://localhost:4502/crx/packmgr/index.jsp)
- Select Upload Package.
- Locate the package you downloaded. Click OK.
- All we have done in the previous session will be replicated to your AEM instance.