Adobe AEM and CQ5 Best Practices – Project Structure
Following are the Adobe AEM and CQ5 best practices, tips and tricks for creating Adobe AEM project, that can save lot of time and effort if used from scratch of project to avail full power and flexibility of Adobe Adobe Experience Manager and Adobe Communique.
Avoid Modification in libs
- If you upgrade content of /libs folder is overwritten by new release, as adobe uses/modify the code written under /libs folder for adding new features.
Always copy components
- Always copy the item from /libs to /apps folder and modify the component in /apps folder.
- By doing this when we upgrade AEM we only need to update our code under apps folder if its affected by new release, unlike /libs our code wont be lost.
- Avoid creating two components with same name.
For example, if we want to customize the title component : copy the component from /libs/foundation/components/title to /apps/<myProject>/components/title
Recommended Structure for creating a Project
Below is the recommended structure for creating a new project under apps folder in CQ. Of course, you are always free to create structure according to your need and choice.
- /apps/<site-id>/components/page/<component> —> specific page component goes here, see below in detail.
- /apps/<site-id>/components/content/<component> –> custom component content goes here.
- /apps/<site-id>/src –> source code of custom module for creating bundles goes here.
- /apps/<site-id>/install –> Jar created by maven goes here.
- /apps/<site-id>/config–> configuration need for OSGI services goes here.
- /apps/<site-id>/il8n–> used for internationalization.
- /apps/<site-id>/widgets –> custom widgets(dialogue we see in authouring) goes here
- /apps/<site-id>/templates/<template> –> Templates are create here
Structure for specific component of page
Below is the recommended structure for creating specific component of page.
- /apps/<site-id>/components/page/base –> cq:Component type it is base component under which below page resides.
JCR Queries Usage
In this section we are going to cover when to use JCR Queries and when not to use them.
It is recommended to use JCR Queries for:
- Real end-user queries, such as full text searches on content folder.
- Situations when content needs to be found across the entire repository or project.
Note: Always make sure to use JCR Queries only when absolutely required.
It is not recommended to use JCR Queries for pure rendering requests like:
- rendering navigation
- creating a “top 10 list of items”
- showing counts of content items
Note: If you want to rendering content, use navigational access to the content tree instead of performing a JCR Query.
Also See Steps for installing CQ5
Leave a Reply