Skip to main content
Level 2
Jan 20, 2016 4:53 PM UTC
Solved

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

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.
david_pérez_rodAccepted solution
Level 2
Jan 21, 2016 3:40 PM UTC

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
Jan 20, 2016 5:37 PM UTC

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. 

Translate
Level 2
Jan 20, 2016 5:55 PM UTC

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

Translate
Kunal_Gaba_
New Member
Jan 20, 2016 10:52 PM UTC

You can try the following pattern for this use case-

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

Translate
Mani_kumar_
Community Advisor
Community Advisor
Jan 21, 2016 6:05 AM UTC

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

Translate
Level 2
Jan 21, 2016 3:39 PM UTC

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

Translate
david_pérez_rodAuthorAccepted solution
Level 2
Jan 21, 2016 3:40 PM UTC

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!

Translate