May 15, 2020
Estimated Post Reading Time ~

Template visibility at every page

In this blog, I am going to share a very interesting point related to the allowedPaths property.

If you create your project and in this project, you create a template and want to create a page using this template, your template will not visible in the siteadmin. But if you copy the same template and paste in the geomtrixx/templates then this template will show you under geometrixx page at siteadmin page creation dialog.

So, the question arises here that why this template visible in geometrixx, and why not visible in our project?
The answer is that geometrixx top-level page has a cq:allowedTemplates property as shown below-



So because of this property, all templates which are created in the geomtrixx project will be visible but our template has no restrictive (allowedPaths, allowedTemplate, etc.) property. 

So for making visible this template we have to add allowedPaths property. This is mandatory for the first or top-level page creation. Now when we create any page under this page, all siblings templates of this template will be visible.
When we add this property, then this template will be visible as displayed below- 



At the top-level page we can add cq:allowedTemplates property so that we can see under this page only those templates which we defined in this property.
To show our template under /content directory or every page under /content directory, we have to add a property on our template named as allowedPaths = /content(/.*)?
In my case I created a template named as homePage with the property allowedPaths = /content(/.*)?



Now this template will show on every page under content directory except geometrixx page.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.