Expand my Community achievements bar.

AEM6.2 Can you create a static page template and editable page templates on the same site?

Avatar

Level 2

Hello, I'm having trouble creating a static page template on our site that already has editable pages. I'm not sure if I'm just creating the template wrong, missing a required call, or if config templates exist that AEM doesn't check for templates in apps.

I have my static template defined in apps, where this documentation says to define a static template

apps/<site-name>/templates/<template-name>

and my editable templates are in

content/conf/<site-name>/settings/wcm/templates

I've tried adding my static template to the conf templates directory, and it then shows up as an option when creating a new page, but the properties tab during page creation is empty and the create button is grayed out. 

Here is my apps static template .content.xml

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:description="Bio Page" jcr:mixinTypes="[mix:lockable]" jcr:primaryType="cq:Template" jcr:title="Bio Page" allowedPaths="[/content(/.*)?]" ranking="{Long}3"> <jcr:content cq:designPath="/etc/designs/<site>" jcr:primaryType="cq:PageContent" sling:resourceType="<site>/components/structure/static-page/bio" cq:template="/apps/<site>/templates/bio-page"> </jcr:content> </jcr:root>
5 Replies

Avatar

Level 2

I'm still trying to figure this out. Please let me know if I'm asking in the wrong place.

Avatar

Level 10

"I've tried adding my static template to the conf templates directory"

Place your static templates under /apps as per the documentation.

Most AEM development involves templates that are created under /apps. 

When you create a editable template - there is no Design mode. With static templates defined under /apps - there is a design mode. 

I see no reason why a project cannot have both types of templates.  

Avatar

Administrator

Hi

There should not be any problem in having both templates in a project.

Why do you want to move Static template (Link:- https://docs.adobe.com/docs/en/aem/6-2/develop/templates/page-templates-static.html) out of "apps/", the best practice is to keep it there. So when you will create a page you can use this Template.

On Same fashion, you should create a editable template in /conf/<your-folder>/ Link:- https://docs.adobe.com/docs/en/aem/6-2/develop/templates/page-templates-editable.html

I hope this would help you.

~kautuk



Kautuk Sahni

Avatar

Level 1

Make sure you have the path to your static templates as a property of cq:allowedTemplates.

This might be located at the project's root node as a property of jcr:content.

/content/[project]/jcr:content

cq:allowedTemplates="[/conf/[project]/settings/wcm/templates/.*,/apps/[project]/templates/.*]"

Avatar

Community Advisor

Hi,

You can use both Editable Template and Static Template in same Project.

Regards,

Varun Rawat