Page without Template in CQ5


During CQ5 interviews, a general question has been asked –

Can we create a page without template?

in this post I will explain it’s answer in detail. before knowing the answer of this question just rethink the definition of a Template.
 
“A template is used to create a Page and defines which components can be used within the selected scope. A template is a hierarchy of nodes that has the same structure as the page to be created, but without any actual content
 
when you create a template using crxde lite then it creates two nodes by default having primaryTypes 
cq:Template as parent
cq:PageContent as child 

When we create a page using template via siteadmin then siteadmin uses  content page component  & it copies all the child nodes under the template to a newly created page node.

and once the page has been created it doesn’t require cq:Template as all the child node of the template copied under cq:Page node & these nodes contains all the required properties to display a component group for that page.

It means if you want to create a page without template you can do that but it’s not possible using siteadmin console as it’s content page component uses templates to create pages.


you have to do all this stuff manually from crxde i.e.

create a node of type cq:Page and save, add cq:PageContent node under page node, add required properties to show the component & if you want to add some default node under this cq:PageContent node add all of them manually.

It’s not a good practice to create a page manually, always use templates as it provides different set of properties which are very helpful while creating pages or websites.
Some of important properties are – 
allowedTemplates
allowedPaths (deprecated Now)
allowedParents
allowedChildren

these properties can be used for filtering the page structure using siteadmin console. but if you are creating a page manually then you have to take care about all of these restriction by your own.

Your comments are heartily welcome. As these comments will update me about my mistakes.

 

Happy Coding
Namah Shivay