Can I mix HTL and SPA components in page?

Avatar

Avatar

Anudeep_Garnepudi

MVP

Avatar

Anudeep_Garnepudi

MVP

Anudeep_Garnepudi
MVP

03-12-2020

Hello Guys,

Is there any way to mix HTL and SPA components in a page (SPA or non SPA template)? Chris Millar at adaptTo conference 2018 said that it is not possible yet. Is there way now? Any Ideas? Thanks.

-AG

AEM htl SPA

Replies

Avatar

Avatar

Vaibhavi

MVP

Avatar

Vaibhavi

MVP

Vaibhavi
MVP

03-12-2020

Hi @Anudeep_Garnepudi , 

 

Please check out the below thread. Solution is discussed in detail. 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/using-general-htl-componen...

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.8K

Likes

1.0K

Correct Reply

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.8K

Likes

1.0K

Correct Reply

1.1K
kautuk_sahni
Community Manager

04-12-2020

See the reply from @Nikhil-Kumar 

 

 

If you want to create any component using SPA template then it's not possible.
But you can have your own template created and and create HTL component in the same project structure.

NOTE: You can not use non SPA component in SPA template. As in SPA everything is client-side rendered.
If you see the body.html we only have root div to render at react side.

You can check out my article on the same, soon I will be coming up with one article in which I will list down the issues that I faced during my AEM+SPA project experience.

Avatar

Avatar

Anudeep_Garnepudi

MVP

Avatar

Anudeep_Garnepudi

MVP

Anudeep_Garnepudi
MVP

04-12-2020

@Vaibhavi , @kautuk_sahni 

Thanks for quick reply. My case is like 2 custom components on page

  1. First/top component only uses HTL as view, no react
  2. Second/bottom component only uses react as view and no HTL

Idea is like the components that are always on top of page will develop using HTL and components which are always used down the page will develop using React.

Avatar

Avatar

Nikhil-Kumar

MVP

Avatar

Nikhil-Kumar

MVP

Nikhil-Kumar
MVP

09-12-2020

@Anudeep_Garnepudi - As far as I know it's not possible to mix a Non SPA and SPA component in SPA page.
But you can try adding adding some text or something at the page template level (Which will be hardcoded not a draggable component), But this will be effective across the template.