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.
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>/nodetypes
- /apps/<site-id>/templates/<template> –> Templates are create here
Structure for a specific component of the 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.
- /apps/<site-id>/components/page/base/base.jsp
- /apps/<site-id>/components/page/base/head.jsp
- /apps/<site-id>/components/page/base/body.jsp
- /apps/<site-id>/components/page/base/header.jsp
- /apps/<site-id>/components/page/base/content.jsp
- /apps/<site-id>/components/page/base/footer.jsp
- /apps/<site-id>/components/page/base/include.jsp
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.
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
No comments:
Post a Comment
If you have any doubts or questions, please let us know.