Sling Resource type- Page creation | Community
Skip to main content
Krishna_C
Level 3
October 16, 2015
Solved

Sling Resource type- Page creation

  • October 16, 2015
  • 2 replies
  • 1934 views

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
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mateusz_Chromin

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

2 replies

Mateusz_ChrominAccepted solution
Level 2
October 16, 2015

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

Krishna_C
Krishna_CAuthor
Level 3
October 16, 2015

Thanks for the info Mateusz.