Expand my Community achievements bar.

SOLVED

Sling Resource type- Page creation

Avatar

Level 4

Hi,   

 
When I create a page using Page Manager ,page will be created with properties "cq:template" and "sling:resourceType" .Resource type will be obtained anyway with the template we are gng to pass as a parameter while creating the page.
 
Can I create a page without "sling:resourceType" property .So that if I change the resource type of the template in the future ,that doesn't effect  my content ? (I have lot pages .I cant change the resource type of each if template is changed)

 

Thanks,
Krishna
1 Accepted Solution

Avatar

Correct answer by
Level 2

The very first part of templates definition, taken from http://dev.day.com/docs/en/cq/current/developing/templates.html : "A Template is used to create a Page"

The content of template is just a plain node hierarchy, that will be copied to the newly created page. There is very loose coupling between instance of template (i.e. page) and template. This binding is defined in the second part of the definition: "defines which components can be used within the selected scope". This is the only dynamic part in the equation.

For the problems like yours, some additional work needs to be done. For bunch of pages, that were created for template with wrong renderer attached it's impossible to change it manually (e.g. using crxde). There are open source tools like Groovy console (https://github.com/Citytechinc/cq-groovy-console) which can invoke the migration code. You can easily find all the pages with given template configured and change sling:resourceType property to the new one you'd like to. Unfortunately, you need to do this operation on every environment affected.

Hope this helps. If any further questions - don't hesitate to ask.
Mateusz

View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

The very first part of templates definition, taken from http://dev.day.com/docs/en/cq/current/developing/templates.html : "A Template is used to create a Page"

The content of template is just a plain node hierarchy, that will be copied to the newly created page. There is very loose coupling between instance of template (i.e. page) and template. This binding is defined in the second part of the definition: "defines which components can be used within the selected scope". This is the only dynamic part in the equation.

For the problems like yours, some additional work needs to be done. For bunch of pages, that were created for template with wrong renderer attached it's impossible to change it manually (e.g. using crxde). There are open source tools like Groovy console (https://github.com/Citytechinc/cq-groovy-console) which can invoke the migration code. You can easily find all the pages with given template configured and change sling:resourceType property to the new one you'd like to. Unfortunately, you need to do this operation on every environment affected.

Hope this helps. If any further questions - don't hesitate to ask.
Mateusz