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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

how to create a folder in a site?

TB3dock
Level 7
Level 7

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
Umesh_Thakur
Correct answer by
Community Advisor
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
Umesh_Thakur
Correct answer by
Community Advisor
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

TB3dock
Level 7
Level 7
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.
rush_pawan
Community Advisor
Community Advisor
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!!
Umesh_Thakur
Community Advisor
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.