homepage_main
content.jsp – includes some basic HTML & includes of the rest of the template content
header.jsp – includes the html to render out top banner and site wide links
footer.jsp – includes html to render typical boiler plate at the bottom of the page
leftnav.jsp – includes the html or an include of the navigation component
contentbody.jsp – lets make this simple for now, just an include of a parsys
rightrail.jsp – same as contentbody, just a parsys
Now a page of type homepage_main is going to be pretty plain, with 2 separate content areas for authors to drop content in a free form manor that has become one of the key differentiators of CQ5. Now this is a fairly simple template that any even remotely practiced CQ5 developer could create in say, an hour or two, depending on how convoluted the front end code is. Now is where the inheritance model of CQ5 really comes into play and really empowers the developer to create additional new templates quickly. The requirements for the system state that a specific marketing tout appear at the top of the right rail on a significant percentage of the pages. So, quickly create a new template …
Create a new template called childpage under apps/
Provide a name for this template, assign it properties for allowedParents, allowedChildren and then set up the sling:resourceSuperType
For the sling:resourceSuperType, set the value to apps/
For simplicity sake, just grab the rightrail.jsp from homepage_main and add either the code for your marketing tout or an include of the appropriate component. You can either replace the parsys or leave it there under the marketing tout for further content.
Under apps/
Now, lets say that we need a page type with a marketing tout and a specific title component above the parsys that displays the page’s jcrTitle. So repeat steps 1-5, but now set the sling:resourceSuperType to point to childpage. Instead of grabbing the rightrail.jsp, copy the contentbody.jsp and edit it to include your title component. And that’s it, you’ve created a page template in a modest amount of time and created its child and grandchild templates in a trivial amount of time. I hope this tutorial simplifies and demystifies the concepts of template creation and inheritance for all of you out there. As always, if you have questions or comments, feel free to contact me.
Keywords: WEM WCM WXM Adobe CQ5 CQ5.5 Java
No comments:
Post a Comment