Experience Fragment issue for AMP page.




I am trying to implement the experience fragment for AMP page. I have converted all core components to be AMP compatible by creating amp.html which is overriding the core components html. This amp.html is invoked with the amp selector in page URL. When an Experience fragment load on an amp page its not loading the amp.html rather loading the core components html which makes that amp page invalid. The body.js invoked in core xfpage component invoke core component html rather than amp.html. 


Experience fragment is loading from OOTB /libs/cq/experience-fragments/components/xfpage  which invokes the body.js (/libs/cq/experience-fragments/components/xfpage/body.js) and Amp does not allow JS.


I need my experience fragment to load amp.html on amp pages. So I need help to load xfpage and core component as Amp valid.





AEM AMP Experience Fragments

Accepted Solutions (1)

Accepted Solutions (1)




AMP support for core components have been added already (see https://github.com/adobe/aem-core-wcm-components/pull/861), so I don't think that there is a need to build it on your own (unfortunately no version number is given for that PR, but should be part of the latest release already, please double-check).


To your question: The page rendering must hand down the "amp" selector to any component. Depending on how much you customized you have to do it either yourself (adapting the <cq:include> tag or its HTL pendant) or see that the product components do it. It would assume that with the adapted core component you are better off. Maybe they have taken a different approach though.





Answers (0)