Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xfpage overlay does not render structure of root element #1209

Open
HitmanInWis opened this issue Aug 7, 2024 · 1 comment
Open

xfpage overlay does not render structure of root element #1209

HitmanInWis opened this issue Aug 7, 2024 · 1 comment

Comments

@HitmanInWis
Copy link

Expected Behaviour

Properties set on the root element of an Experience Fragment in the XF Template Structure are rendered when the XF is included in a page via the WCM Core Experience Fragment component.

Actual Behaviour

When a XF is included in a page via the WCM Core Experience Fragment component, structure elements are rendered correctly for all child resources of the root, but the root element is NOT rendered with its structure properties.

Reproduce Scenario (including but not limited to)

Template Content Node:

  • Path: /conf/mysite/settings/wcm/templates/structure--website-header/structure/jcr:content
  • Properties:
    • sling:resourceType: mysite/components/xfpage (XF component type from archetype)

Template Root Node:

  • Path: /conf/mysite/settings/wcm/templates/structure--website-header/structure/jcr:content/root
  • Properties:
    • id: id-from-structure
    • sling:resourceType: mysite/components/container

Experience Fragment Content Node:

  • Path: /content/experience-fragments/mysite/header/master/jcr:content
  • Properties:
    • cq:template: /conf/mysite/settings/wcm/templates/structure--website-header

Experience Fragment Root Node:

  • Path: /content/experience-fragments/mysite/header/master/jcr:content/root
  • Properties:
    • id: this-should-be-ignored
    • sling:resourceType: mysite/components/container

Page Rendering Node:

  • Path: /content/mysite/test/jcr:content/root/container-bodywrapper/experiencefragment
  • Properties:
    • fragmentVariationPath: /content/experience-fragments/mysite/header/master
    • sling:resourceType: mysite/components/experiencefragment (extends core/wcm/components/experiencefragment/v2/experiencefragment)

When the Page node is rendered, the root element HTML has id this-should-be-ignored from the Experience Fragment content node, when instead it should have id-from-structure from the XF template structure node.

Cause

This appears to be caused by https://github.com/adobe/aem-project-archetype/blob/develop/src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/xfpage/content.html

Instead of rendering the templated root resource, the HTML file delegates to a new data-sly-resource pointed at the resource content path, thus losing the structure elements from the template.

@HitmanInWis
Copy link
Author

FWIW I was able to resolve in my implementation by changing the contents of /apps/mysite/components/xfpage/content.html

from:

<sly data-sly-use.body="body.js" data-sly-resource="${body.resourcePath @ selectors=[]}" />

to:

<sly data-sly-use.templatedContainer="com.day.cq.wcm.foundation.TemplatedContainer"
     data-sly-repeat.child="${templatedContainer.structureResources}"
     data-sly-resource="${child @ decorationTagName='div', selectors=[]}"></sly>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant