CQ5 page templates are simply models used to create new pages. They can contain as little, or as much, initial content as needed, their role being to create the correct initial node structures, with the required properties (primarily sling:resourceType) set to allow editing and rendering.
Creating a new Template (based on an existing template)
Needless to say a new template can be created completely from scratch, but often an existing template will be copied and updated to save you time and effort. For example, the templates within Geometrixx can be used to get you started.
-
Copy an existing template (preferably with a definition as close as possible to what you want to achieve) to a new node.
|
Note |
Templates are usually stored in /apps/<website-name >/templates/<template-name > . |
-
Change the jcr:title of the new template node to reflect its new role. You can also update the jcr:description if appropriate.
-
Copy the component on which the template is based (this is indicated by the sling:resourceType property of the jcr:content node within the template) to create a new instance.
|
Note |
Components are usually stored in /apps/<website-name >/components/<component-name > . |
-
Update the jcr:title and jcr:description of the new component.
-
Replace the thumbnail.png
if you want a new thumbnail picture to be shown in the template selection list.
-
Update the sling:resourceType of the template's jcr:content node to reference the new component.
-
Make any further changes to the functionality or design of the template and/or its underlying component.
Changes made to the /apps/<website>
/templates/<template-name
>
node will affect the template instance (as in the selection list).
Changes made to the /apps/<website
>/components/<component-name
>
node will affect the content page created when the template is used.
You can now create a page within your website using the new template.
眼镜蛇