project structure in CQ5 and its Importance

By | 07:43 Leave a Comment
The structure of project is very important in cq5 as the software allows overriding of the base(foundation) functionalities easily by replicating the structure inside your project.

The  commonly used structure is as shown in the below diagram

These are some of the folders present in the root of the cq's tree.

The libs folder as the name says is the library folder of the software.It contains the code for most of cq's functionality; most important from developers point of view among the folders is FOUNDATION folder.

The foundation folder contains all the OOTB components and is often used by developers to extend the components.



The etc  folder holds the designs, the common 'CSS' and design level configurations go into this folder.

The apps folder contains all the projects.The sub folders of a project are structured as shown inside the apps rectangle [/apps/your project/components,install an so on].

template-->holds the templates of the website
components-->this folder holds all the custom components you make. It often contains sub folders like page,global,common etc.. The convention is to put components that render your templates into the page folders. the ones you use throughout the site in global. You can go on to create separate folders for particular sections of your website for better organisation.
src-->The OSGI bundles(java classes for back end functionality)are created in this folder.
install-->The compiled classes of the bundles in src get stored in this folder.

The content folder contains the pages you make for the website using the templates. All the data in the components you add to the page are stored under the page's node in the content folder.


The names of folder and structure is critical in cq5 because when you want to override a specific part of the library with this set up all you do is create the exact same structure within the your app folder of apps. Copy the library folder and modify it to suit your situation.The cq software will give this definition more priority and override the library definitions within that project.


This can be carried out multiple times within a project, the inner most definition will override others; similar to function overriding of OOPS allowing you to modify default behaviour for each section of your website.

0 comments:

Post a Comment