Expand my Community achievements bar.

SOLVED

how to create a folder in a site?

Avatar

Level 9

we want to group some pages into a folder, none of the pages for folder should appear in the navigation (they are pulled out using servlets).  How do we create a folder in our site, vi source code? NOT via the UI?   We need it in source code so that we can distribute the folder to all the environments, including local dev instances.

Even in the UI, we cant see an option to create folders?

By folder, I mean a parent node in the page hierarchy.  Websites have a hierarchy - e.g. at the top there might be pages such as contact and about us, but there might be an articles node/directory which has lots of child pages in side this.  We have seen sites with this structure in AEM, just don't know how to make it.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

It seems like your requirement is not suitable in this scenario:

which ever the project, I worked for, I have not seen any folder specifically in content page path. I have seen the hierarchy even many level of hierarchy but those were of cq:Page type only.

Even we have servlets registered with ResourceType those are also of cq:Page type or nt:unstructured type node but that too under the cq:page only.

So I would suggest take help from empty page template, if needed to create the hierarchy or to separate the page content type within it.

But Still you need to create folder then you can take help from crx/de to create sling:folder in any path or if you want it to be created by code then also you can take help from jcr api to add one node on the specific path with desired type.

 

Hope this will help.

Umesh Thakur

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

It seems like your requirement is not suitable in this scenario:

which ever the project, I worked for, I have not seen any folder specifically in content page path. I have seen the hierarchy even many level of hierarchy but those were of cq:Page type only.

Even we have servlets registered with ResourceType those are also of cq:Page type or nt:unstructured type node but that too under the cq:page only.

So I would suggest take help from empty page template, if needed to create the hierarchy or to separate the page content type within it.

But Still you need to create folder then you can take help from crx/de to create sling:folder in any path or if you want it to be created by code then also you can take help from jcr api to add one node on the specific path with desired type.

 

Hope this will help.

Umesh Thakur

Avatar

Level 9
are you saying to create child pages of a "directory", you have to use a page as a directory? If so, how do yo stop the parent page being viewed, as its not actually a page.

Avatar

Level 9
just to add my bit. Creating folder structure would be not good idea as it will carry various other problems in publishing/rollout/language copy and others. Using empty page or a blank page would be good option. now to identify them separately in your servlet or similar, you can either create some custom property to identify it or use the sling:resourceType. you can easily figure it out. hope it helps!!

Avatar

Community Advisor
view restriction can we done in two way, one will be thru user permission and another will thru dispatcher rule. Let say in every multilingual site we have language page ,which we use normally for configuration an all but not for user view so we restrict that from dispatcher rewrite rule. it is easily doable. Hope this will help.