“When looking into editable templates, what is the purpose of using a template type? I’ve read it’s the ‘template of a template’, but still, it is not quite clear to me.
Does editing a template type impose the same effects as editing a template?”
It is true that a template type is basically the ‘template’ of a template. In theory, when you create a new template, the selected template type, with the underlying structure, initial and policies child nodes are copied to the new template, and a reference to that template type are stored. This reference is just informational.
I am someone who prefers to see things visually to easier understand what’s going on, so therefore, have a look at this image:
This image shows you that when creating a template, the structure, initial, and policy nodes (and child nodes) are copied on creation from the template type.
A page will copy the child nodes of the initial node as child nodes of the jcr:content node on page creation and reference the structure child nodes to load them dynamically when the page is loaded. It will then apply the policies on the content nodes.
You should keep in mind that changing the initial content, structure, or policies of a template type WILL NOT affect already existing templates, but it WILL affect new templates.
But why do you need to have a template type? That’s easy enough, you need one to create a template!
Template types are created and maintained by your developers, in the same way as static templates were created and maintained by developers. Any changes to these template types can only be done by either editing it in CRX/DE or by deploying a new version of them (which is obviously the preferred method).
You could ask yourself if it’s not a good idea to simply have 1 ‘empty’ template type and create every template based on that template type. The answer to that is “it depends”.
A good rule of thumb is that if your organization has a lot of templates that are very alike, you should create a new template type to save your template authors the effort they have to put in to create a new template.
So, a few pointers to remember from this article
An easy way for me to get a better understanding of what a template type is was by comparing it to what I already knew about AEM. I’ve worked with older versions of AEM (6.0 and 6.1) and there you only had the concept of “static templates”. Well, a template type could be compared to a static template, and your dynamic template could be a page created with a static template. If you made a change to your static template, your existing page structure wouldn’t change. The same goes when changing your template type because it will not change your dynamic template.
I am someone who prefers to see things visually to easier understand what’s going on, so therefore, have a look at this image:
This image shows you that when creating a template, the structure, initial, and policy nodes (and child nodes) are copied on creation from the template type.
A page will copy the child nodes of the initial node as child nodes of the jcr:content node on page creation and reference the structure child nodes to load them dynamically when the page is loaded. It will then apply the policies on the content nodes.
You should keep in mind that changing the initial content, structure, or policies of a template type WILL NOT affect already existing templates, but it WILL affect new templates.
But why do you need to have a template type? That’s easy enough, you need one to create a template!
Template types are created and maintained by your developers, in the same way as static templates were created and maintained by developers. Any changes to these template types can only be done by either editing it in CRX/DE or by deploying a new version of them (which is obviously the preferred method).
You could ask yourself if it’s not a good idea to simply have 1 ‘empty’ template type and create every template based on that template type. The answer to that is “it depends”.
A good rule of thumb is that if your organization has a lot of templates that are very alike, you should create a new template type to save your template authors the effort they have to put in to create a new template.
So, a few pointers to remember from this article
- You are required to have at least one template type to create a new template
- Changes to a template type are not reflected existing templates
- Template types are created and maintained by your developers
No comments:
Post a Comment
If you have any doubts or questions, please let us know.