3
votes

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>
3
Its not clear, what you want fixed. Do you want your static template working under /apps (the way pre 6.2 templates used to work) or you want it to be a configurable template using template editor?Ameesh Trikha

3 Answers

0
votes
  • Your static template not working when defined under /apps/<site>/templates, in your above XML for template definition the jcr:content shouldn't have property cq:template. The property cq:template exists in the pages created using the templates.

Where are you trying to create the page using your template, the template thou defines that allowed path as /content and any hierarchy below it but this may be limited/restricted by the properties allowedChildren and allowedParents on other templates in your hierarchy. Try creating a page directly under /content where no other limitation will apply. Are you able to create page then?

  • Moving your template under /conf/<site-name>/settings/wcm/templates needs you to associate structure to it where in you define sling:resourceType="<site>/components/structure/static-page/bio", this will be responsible for the defined properties that you see in the create page wizard. If reused/copy pasted the template from /apps to /conf then you may be missing this structure, adding which will fix the issue

enter image description here

0
votes

Make sure your sling:resourceType path is 100% correct. The case of the sling:resourceType property on jcr:content is case sensitive, so make sure you've verified the case matches in the path as well.

I have seen this same problem (AEM 6.2).

In

/apps/<site>/templates/<templatename>/jcr:content

I had a typo in the sling:resourceType property.

I had entered the name with incorrect case (mySite vs mysite).

Correcting the path resolved the issue.

0
votes

By default, if you created your editable template through the UI, as opposed to coding it by hand, and then proceeded to create the site's root page using this template, the editable template and hence the site's root page will have a very restrictive cq:allowedTemplates value, such as /conf/mysite/settings/wcm/templates/.*. To allow static templates to co-exist with the editable template on the same site, you'll need to add /apps/mysite/components/templates/.* to the editable template's cq:allowedTemplates.