Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Content migration from one template to the other

Avatar

Level 1

Hi - I am new to AEM CMS development.I am working on a POC for automated content migration from one template to the other. Wanted to know if its possible in AEM . My naive approach when I heard about this POC was to create the content as components ( say with the required styling ) and just call the content component from the required components . Please correct me if I am wrong or if there is a better approach . Thank you .

1 Accepted Solution

Avatar

Correct answer by
Level 7

You can create different view in AEM with usage of selectors.

What you can do is a template with 2 different view, configurable with page properties.

It could be a solution for you? if yes i can provide you some example code.

View solution in original post

11 Replies

Avatar

Level 10

A template is simply a node in AEM that points to a cq:Component node where you define the markup of the page. When you are saying you automating content from one template to another - can you be more specific. What content are you moving?

Avatar

Level 1

Thanks for replying . So the required scenario for this POC is . Say for a given home page , there are two different templates. The Content editors can use either template 1 or template 2. But any template they switch , the content should be automatically migrated . This is the requirement . So want to know if this is possible . If there is any reading material , related links please direct me to it . 

And thanks again . 

Avatar

Employee Advisor

Hi,

I still don't see, what you need to do. So I assume, that your content authors used a template A to create their pages, but it should be switched to template B for some reasons. Is that assumption correct?

And what are you supposed to change then? Is the content structure of these 2 templates different?

 

Jörg

Avatar

Level 7
        So what you need is just to have 2 different view of the same page? i.e. homepage?

Avatar

Administrator

Hi 

Assuming that what "Jörg" wrote is your actual problem, then the solution i could think of is:-

1. You can reuse some of the component in you template :-

    Link:- http://stackoverflow.com/questions/22392147/cq5-preload-a-parsys-with-components

    Link:- http://suryakand-shinde.blogspot.in/2015/01/how-to-create-page-with-predefined.html

The concept here is, to create a page with predefined components.

~kautuk



Kautuk Sahni

Avatar

Level 1

yes - the requirement is that when the content authors choose template B instead of template A, then the content from template A should be automatically migrated to template B. So is this possible within AEM ? 

Avatar

Correct answer by
Level 7

You can create different view in AEM with usage of selectors.

What you can do is a template with 2 different view, configurable with page properties.

It could be a solution for you? if yes i can provide you some example code.

Avatar

Level 10

YOu can pass me that sample and we can base a helpx community article on it. That looks like a great use case to capture to help the AEM community. Send to scottm@adobe.com. We can discuss further. 

Avatar

Level 1

Yes - if its like a small demo that I can see and understand , then it will be really helpful. 

Thank you. 

Avatar

Level 3

Is this assuming that the author implemented the content in Template A to begin with?

 

Why would the author switch templates?

 

(I can't recall having to switch templates without deleting the page and starting all over again)