Expand my Community achievements bar.

6.5.x: Is there an equivalent to allowedPaths for editable templates?

Avatar

Level 9

as above.

 

The nice thing with allowedPaths is that I can configure the template myself so the authors (who are not really technically inclined and just wants things to work) do not have to do anything.

 

PS. I know it can be done using page properties but that still requires some author intervention. (see image below)

 

2024-05-20 16_35_54-Magazine _ AEM Sites _ Page Properties and 18 more pages - Profile 1 - Microsoft.jpg

4 Replies

Avatar

Community Advisor

@jayv25585659 

 

Please refer to https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/allowedpaths-and-allowedpa...

 

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/pla...

 

 
  •  

 

The following properties determine whether a template T is 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 the jcr:content subnode of P or an ancestor of P.

  • The allowedPaths property of T.

  • The allowedParents property of T.

  • The allowedChildren property of the template of P.

The evaluation works as follows:

  • The first non-empty cq:allowedTemplates property found while ascending the page hierarchy starting with P is matched against the path of T. If none of the values match, T is rejected.

  • If T has a non-empty allowedPaths property, but none of the values match the path of P, 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 as P. T belongs to the same application as P if and only if the name of the second level of the path of T is the same as the name of the second level of the path of P. For example, the template /apps/geometrixx/templates/foo belongs to the same application as the page /content/geometrixx.

  • If T has a non-empty allowedParents property, but none of the values match the path of P, T is rejected.

  • If the template of P has a non-empty allowedChildren property, but none of the values match the path of T, T is rejected.

  • In all other cases, T is allowed.

 

AEM offers multiple properties to control the templates allowed under Sites. However, combining them can lead to complex rules that are difficult to track and manage.
Therefore, Adobe recommends that you start simple, by defining:
  • only the cq:allowedTemplates property

  • only on the site root


Aanchal Sikka

Avatar

Level 10

Hi @jayv25585659 ,

In AEM 6.5.x, there is no direct equivalent to the `allowedPaths` property for editable templates. The `allowedPaths` property is typically used in component dialog definitions to restrict the selection of pages or assets.

However, you can achieve a similar effect by using the `allowedParents` property in the template policy. The `allowedParents` property allows you to specify the allowed parent pages for creating new pages based on a template.

To configure the `allowedParents` property for an editable template:

1. Open the template in the Template Editor.
2. Click on the "Policies" tab.
3. Create or select the policy that you want to modify.
4. In the policy configuration, locate the "Allowed Parents" section.
5. Add the paths of the allowed parent pages in the "Allowed Parents" field. You can specify multiple paths separated by commas.
6. Save the policy and close the Template Editor.

By setting the `allowedParents` property, you can control where authors can create new pages based on the template. This helps ensure that authors can only create pages in the specified locations, reducing the need for author intervention.

Note that the `allowedParents` property is applied at the template level, so it affects all components within the template. If you need more granular control over specific components, you may need to consider other approaches such as custom validation or custom component logic.

Overall, while there is no direct equivalent to `allowedPaths` for editable templates in AEM 6.5.x, the `allowedParents` property can provide a similar level of control over page creation.

Avatar

Level 9

@HrishikeshKa any chance you can provide some screenshots (or link) to this "policy" tab? I have my editable template opened in editor and...

 

1. I cannot see any policy tab in the edit view.

2. I can see there's a "page policy" in the menus but when I opened it, I cannot see any allowed parents". (see screenshot for details)

 

Thanks

 

2024-05-20 21_55_23-Annotate Image and 16 more pages - Profile 1 - Microsoft​ Edge.jpg

 

 

Avatar

Administrator

@jayv25585659 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni