Duplicate main editable template and all pages using that template | Community
Skip to main content
December 7, 2022
Solved

Duplicate main editable template and all pages using that template

  • December 7, 2022
  • 2 replies
  • 1293 views

We’re trying to replicate/duplicate 70+ articles which use a template with an experience fragment as header. We want to duplicate, not replace, the same articles and content but using a different experience fragment as header. 

 

Here are the steps we tried to replicate the article with different experience fragment:

  1. Create new experience fragment – make copy of existing fragment and made updates from there
  2. Create a new article template -- copying existing article template, then update experience fragment to new fragment

 

Is there a way we can duplicate the template and all pages that use this template? From there, I believe we can make changes to the editable template. We need to streamline the duplication process since we have 70+ articles using this template/experience fragment.

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 Avinash_Gupta_

Hi @kiran_vedantam 

 

Scenario here is to duplicate, not replace, the same articles and content but using a different experience fragment as header. Both the content old and new(with updated XF) need to exist together and the template uses a XF as a header. This can only be handled by creating a new or duplicating the existing template and the new template would refer to either the new XF or the variation of it.

2 replies

Avinash_Gupta_
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 7, 2022

Hi @aym2 

 

Based on your requirement, here are the few steps that you can try:-

 

1. Create a new editable template. Either copy from the existing one or create a new one and author it with correct experience fragment.

2. Copy and paste all the 70 pages from the old template.

3. Change the below properties in page's jcr:content to make it work

cq:template

 sling:resourceType

 

Since there are only 70 pages, you can go to CRXDE and manually update the properties as mentioned above but you can also leverage Groovy script to update the template.

 

Hope this helps.

Kiran_Vedantam
Community Advisor
Community Advisor
December 7, 2022

@avinash_gupta_ I fear that might not work:

Thanks,

Kiran Vedantam.

Avinash_Gupta_
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 7, 2022

@kiran_vedantam You can go to CRXDE and change the template resource type.

 

 

Also, ACS commons provide a utility to update the sling:resourceType and cq:Template properties in bulk

 

https://adobe-consulting-services.github.io/acs-aem-tools/features/csv-resource-type-updater/index.html

Kiran_Vedantam
Community Advisor
Community Advisor
December 7, 2022

Hi @aym2 

 

For the XF, you can either create a new XF or a variation of the existing XF.

 

For the duplication and replacement of the old XF, the best way I see is to manually/programmatically update the XF path once the duplication is done.

 

If you go with a new template approach, you wouldn't be able to update the page template/resourceType as per the documentation: https://experienceleague.adobe.com/docs/experience-manager-65/authoring/authoring/managing-pages.html?lang=en

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

Avinash_Gupta_
Community Advisor and Adobe Champion
Avinash_Gupta_Community Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
December 7, 2022

Hi @kiran_vedantam 

 

Scenario here is to duplicate, not replace, the same articles and content but using a different experience fragment as header. Both the content old and new(with updated XF) need to exist together and the template uses a XF as a header. This can only be handled by creating a new or duplicating the existing template and the new template would refer to either the new XF or the variation of it.