In previous tutorial, we learn about Templates in aem ,and Static templates in aem, what is aem, that and how to make static templates in aem.
In this tutorial we will see another kind of template ie editable templates in aem, what editable templates are, how to create editable templates in aem using maven build tool, although we can make it using aem console also, but while creating a project structure using Maven , will create a default editable template for us.
So let’s start.
What is Editable templates in aem
Templates are mainly used in Adobe Experience Manager 6.4 and considered as the best practice. They can be created and edited by authors. There remains a dynamic connection between the page and template after page creation which allows changes to reflect on pages also if any made on template. These templates are stored in /conf folder. The editable template allows authors to lock or unlock content for controlled access by Page Authors.
Now let’s see how Editable templates in aem are created: Editable templates can be created automatically when we create project structure from Maven(Recommended) and project structure can be created using maven in following manner:
1. Go to command prompt and use the following code mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=13 -DarchetypeCatalog=https://repo.adobe.com/nexus/content/groups/public/
2. Then you’ll be asked to fill some properties, fill them as follows: groupId = com.adobe.aem.guides
artifactId = aem-guides-myproject
Version = 0.0.1-SNAPSHOT
package = com.adobe.aem.guides.myproject
appsFolderName = Myproject
artifactName = myproject Sites Project
componentGroupName = myproject.Content
confFolderName = Myproject
contentFolderName = Myproject
cssId = Myproject
packageGroup = aem-guides/myproject
siteName = MYPROJECT Site
press y when prompted.
3. Then build your project by changing directory to the created project folder and using following command mvn -PautoInstallPackage -Padobe-public clean install And you’ll finally get to see an auto-generated Editable Template. We can also create our own customized Editable Template without using maven in the following way:
1. Go to configuration browser and select tools>Templates>YourProject>Create and choose the type of template(use HTML5).
2. Now name the template and click to open the created template.
3. Now Enable the template by selecting a template(Created Template) from Templates console and select enable from the toolbar.
4. Now in order to use created Editable template to our pages, we have to add the template path to a page in the following manner:
a. Select your page and open the root page from the site Admin.
b. Go to page properties > Advanced > Template settings.
c. Add Allowed templates and paste /conf/Yourprojectname/settings/wcm/templates/.* (this is the path of current created Templated)