Static Templates
Static Templates:
- Must be defined and configured by your developers.
- This was the original templating system of AEM and has been available for many versions.
- A static template is a hierarchy of nodes that has the same structure as the page to be created, but without any actual content.
- Are copied to create the new page, no dynamic connection exists after this.
- Uses Design Mode to persist design properties.
- Are stored under
/apps
- See Static Templates for further information.
Template Availability
-
only the
cq:allowedTemplates
property -
only on the site root
/content/we-retail/jcr:content
allowedPaths
, allowedParents
, and allowedChildren
can also be placed on the templates to define more sophisticated rules. However, when possible, it is much simpler to define further cq:allowedTemplates
properties on sub-sections of the site if there is a need to further restrict the allowed templates.cq:allowedTemplates
properties can be updated by an author in the Advanced tab of the Page Properties. The other template properties cannot be updated using the (standard) UI, so would need a developer to maintain the rules and a code deployment for every change.When creating a new page in the site admin interface, the list of available templates depends on the location of the new page and the restrictions on placement specified in each template.
The following properties determine whether a template T
is allowed to be used for a new page to be placed as a child of page P
. Each of these properties is a multi-value string holding zero or more Regular Expressions that are used for matching with paths:
-
The
cq:allowedTemplates
property of thejcr:content
subnode ofP
or an ancestor ofP
. -
The
allowedPaths
property ofT
. -
The
allowedParents
property ofT
. -
The
allowedChildren
property of the template ofP
.
The evaluation works as follows:
-
The first non-empty
cq:allowedTemplates
property found while ascending the page hierarchy starting withP
is matched against the path ofT
. If none of the values match,T
is rejected. -
If
T
has a non-emptyallowedPaths
property, but none of the values match the path ofP
,T
is rejected. -
If both of the above properties are either empty or non-existent,
T
is rejected unless it belongs to the same application asP
.T
belongs to the same application asP
if and only if the name of the second level of the path ofT
is the same as the name of the second level of the path ofP
. For example, the template/apps/geometrixx/templates/foo
belongs to the same application as the page/content/geometrixx
. -
If
T
has an non-emptyallowedParents
property, but none of the values match the path ofP
,T
is rejected. -
If the template of
P
has a non-emptyallowedChildren
property, but none of the values match the path ofT
,T
is rejected. -
In all other cases,
T
is allowed.
The following diagram depicts the template evaluation process: