AEM - How to restrict a template from showing in a certain path | Community
Skip to main content
Level 2
January 20, 2016
Solved

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

  • January 20, 2016
  • 6 replies
  • 6019 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by david_pérez_rod

At the end it seems that http://stackoverflow.com/questions/34905975/aem-how-to-restrict-a-template-from-showing-in-a-certain-path response worked as expected.

 

Thank you all!

6 replies

smacdonald2008
Level 10
January 20, 2016

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. 

Level 2
January 20, 2016

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-path. 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 :)

Kunal_Gaba_
January 20, 2016

You can try the following pattern for this use case-

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

Mani_kumar_
Community Advisor
Community Advisor
January 21, 2016

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

Level 2
January 21, 2016

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

david_pérez_rodAuthorAccepted solution
Level 2
January 21, 2016

At the end it seems that http://stackoverflow.com/questions/34905975/aem-how-to-restrict-a-template-from-showing-in-a-certain-path response worked as expected.

 

Thank you all!