Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM - How to restrict a template from showing in a certain path

david_pérez_rod
Level 1
Level 1

Hi!,

I wonder if someone has achieved what I'll post here. In order to allow a template to be created under a certain path, there is a flag allowedPaths that receives a regex.

So, if I want my template "test" to appear only under /content/www/xx/xx/test-templates and child elements, I can do this:

    

/content/www/.*/.*/test-templates(/.*)?

 

But what if I want to make the opposite? I want the template "test" to appear in every /content/www/xx/xx/ node and beyond, EXCEPT /content/www/xx/xx/test-templates and children?

I have tried several ways but no luck so far. Do you have some hint regarding this?

 

Thanks!

1 Accepted Solution
david_pérez_rod
Correct answer by
Level 1
Level 1
6 Replies
smacdonald2008
Level 10
Level 10

See this KB:

https://helpx.adobe.com/experience-manager/kb/LimitChildPages.html

But there does not seem to be a way to restrict only a part of an allowed JCR path. 

david_pérez_rod
Level 1
Level 1

Thank you sir! I took a look at that article and also asked this question http://stackoverflow.com/questions/34905975/aem-how-to-restrict-a-template-from-showing-in-a-certain.... There's a promising comment there, which probably I could use with allowedPaths in order to restrict those paths that does not match the given regex.

I'll post my results here in a few 🙂

kunal23
Level 10
Level 10

You can try the following pattern for this use case-

^/content/www/xx/xx/(?!(test-templates)).*$

Manikumar
Level 4
Level 4

Hi,

I found the pattern content\/www\/xxx\/xxx\/xxx\/legal\/(?!(test)).*$ this will work for your usecase 

Kunal i think same as ur regex may be i am late 🙂

 

Thanks

Mani Kumar K

david_pérez_rod
Level 1
Level 1

Thank you! but those xx are intended to be anything (.*) and when you do this the regex changes 😕

david_pérez_rod
Correct answer by
Level 1
Level 1