Note: There is no fixed pattern. This is how its generally done
The pages in cq5 are created in a tree structure. This helps in managing multi-language and multi-national websites.'i18n' features of cq5 are very easy to use when the pages are created in a tree structure. All the actual pages are created under the language node.
To create a page you have to pick a template. What the template actually does is specify the sling:ResourceType property for that page. 'sling:ResourceType' property is a sling concept that tells which script is going to render that node [check out this link for more].
Creating the template: On the templates folder of your project [for project structure, hit this link], right-click and select create template [in crxde lite]. Give it a title and label and you'll see a field for the resource type. Leave it blank for the time being and then fill in the other fields. Now you have a template, but it's still not usable because there is no script to render it.
Creating the rendering script: To create a component that renders the template, go to components/page component of your project. Right-click on that folder and select create a new component. Give it a title and label. A jsp file, with the same name as the label you give, will be created by default. While creating the component give the path of the foundation page component as the sling:resourceSuperType.
What the sling:resourceSuperType tells is the place of the default script that handles the component. Sling engine will treat that as default and any code in your component's jsp is actually overriding the default script. When the default script has a lot of parts say body, header, footer, and so on... to extend only one of them; let's say header, for example, give the default script's path as sling:resourceSuperType in your custom component. Then copy the contents of the jsp that is of the same name as the default script component to your component's script. Now create a jsp with the same name as the header in your component and write the code that you want.
The sling engine will come to the content node and check the resource type. This will make it use your component to render the content. In the content, all it'll find is the default jsp and header jsp but the default jsp has included too few other jsp's. The sling engine will then use the sling:resourceSuperType property to reach the default component and use the body, footer, etc. present in that component.
A sling node can have multiple scripts to render it; for example, a page can be rendered in desktop view, printer-friendly view, mobile view, and so on. This can be done by creating multiple jsp files inside a component with proper selectors.
In the url, if sling doesn't find any selectors then it will use the jsp that has the same name as the component to render it by default. If there are selectors in the url and they match the ones on the scripts, then the content will be rendered by that script. For rules of url decomposition, hit this link.
The pages in cq5 are created in a tree structure. This helps in managing multi-language and multi-national websites.'i18n' features of cq5 are very easy to use when the pages are created in a tree structure. All the actual pages are created under the language node.
To create a page you have to pick a template. What the template actually does is specify the sling:ResourceType property for that page. 'sling:ResourceType' property is a sling concept that tells which script is going to render that node [check out this link for more].
Creating the template: On the templates folder of your project [for project structure, hit this link], right-click and select create template [in crxde lite]. Give it a title and label and you'll see a field for the resource type. Leave it blank for the time being and then fill in the other fields. Now you have a template, but it's still not usable because there is no script to render it.
Creating the rendering script: To create a component that renders the template, go to components/page component of your project. Right-click on that folder and select create a new component. Give it a title and label. A jsp file, with the same name as the label you give, will be created by default. While creating the component give the path of the foundation page component as the sling:resourceSuperType.
What the sling:resourceSuperType tells is the place of the default script that handles the component. Sling engine will treat that as default and any code in your component's jsp is actually overriding the default script. When the default script has a lot of parts say body, header, footer, and so on... to extend only one of them; let's say header, for example, give the default script's path as sling:resourceSuperType in your custom component. Then copy the contents of the jsp that is of the same name as the default script component to your component's script. Now create a jsp with the same name as the header in your component and write the code that you want.
The sling engine will come to the content node and check the resource type. This will make it use your component to render the content. In the content, all it'll find is the default jsp and header jsp but the default jsp has included too few other jsp's. The sling engine will then use the sling:resourceSuperType property to reach the default component and use the body, footer, etc. present in that component.
A sling node can have multiple scripts to render it; for example, a page can be rendered in desktop view, printer-friendly view, mobile view, and so on. This can be done by creating multiple jsp files inside a component with proper selectors.
In the url, if sling doesn't find any selectors then it will use the jsp that has the same name as the component to render it by default. If there are selectors in the url and they match the ones on the scripts, then the content will be rendered by that script. For rules of url decomposition, hit this link.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.