10/23/2020

AEM 6.5 - Create and Use Templates to Build A Page

 AEM 6.5 - How to Create Templates to Build a Page in your Site

Editable Template vs Static Templates

Template Types

1) Static Templates - Must be defined, develop and configured by AEM Developers

  • Static templates are stored under /apps folder in crx/de repository
  • We have to use Design Mode to do changes
  • Uses Design mode to persist the design properties
  • Changes / Modification to the static template will not apply or reflect directly / immediately to the pages created using the respective template
 2) Editable Templates - Can be created and modified by Authors - Template editors
  • Editable Templates are stored under /conf folder in crx/de repository
  • Uses content policies to persist the design properties
  • Changes to editable templates should use policy
  • Any changes to Editable Templates will directly impact / apply  on the pages created
How to Create Static Templates and Editable Templates and Configure content policies


To create a Static template - in your AEM author instance open crx/de --> then go to /apps folder
  • /apps/<your project folder> / templates
  • select templates node - right click and select Create Template option
  • In the Create Template Dialog enter Label, Title, Description 
  • Resource Type **  this filed defines the page component which will be rendering the pages which are created using this template
  • we will provide page rendering component path in this Resource Type
  • /apps/<your project folder>/components/structure/rootPage
  • The ranking defines the order of this template
  • Allowed paths - we have to provide the path, where this template can be available - /content/*
  • Allowed Parents - To restrict the usage of the template by giving allowed parents
  • Allowed Children - same like allowed parents to restrict the usage of template (you can leave empty for now)

Now - we have to create the rootPage component under apps
  • go to crx/de /apps/<your project folder>/component/structure
  • right click and select create component option

in Component create dialog enter details
  • label - root-age
  • Title - Root Page
  • Description - Root Page Component
  • Super Type - Super Type defines the parent of the component
  • we can use the OOB component available /libs/foundation/components/page
Now go to your Sites and your project site, Create Page and Select Template to create a new page



==========================================================================
Editable Templates

1) How to create Editable Templates
2) How to set up initial content
3) What are the benefits using Editable Templates

Editable Templates and Its Benefits:
  • Editable Templates allow Template Author to Create and Edit Templates , remove dependency on developers
  • Editable Templates maintain the relation between the pages created using editable templates, it means, any changes or updates to the editable template will apply or reflect immediately to the pages created of that template
  • Make the page component more generic so that the core page component can be used without customization
How to Create Editable Templates?
  • To create editable templates - first we have to create a project folder in Configuration Browser
  • Go to AEM Sites (AEM Landing Page) , then go to side navigation click Tools icon (Hammer)
  • Then Select / Click on Configuration Browser
  • Then Click on Create - in pop up window, enter your website name and select Editable Template Check box and click on Create.



Pop up 

Now go to Main Navigation Tools --> General --> Templates
you can see your created folder



Also - Goto - crx/de --> conf --> <your project> --> settings --> wcm
you can see 
1) templates
2) policies
3) template-types

Template node will be empty as we haven't created any template for this project
Now go back to AEM Templates folder you created in Touch UI and click on Create and then select an available Template Type 
(These template types will be available by default when you create your project with any of the AEM Arch type)

The editable templates are based on the template types
In Next window give Title and Description click on Create
Now the newly created template available in Template Editor , now we can work on this template.
In this template editor we will have 3 options
  • Structure - to define the structure of the template/page
  • Initial Content - Initial content which is going to be available to the pages that are created using this template
  • Layout - we can define all the components and layout the 


No comments:

Post a Comment