Aem 如何从template content.xml文件将两个组件包装到一个div中?
我有两个组件应该在cq模板中配置,在content.xml文件中(在jcr:content节点中)。 我的模板没有页面组件,因此无法执行以下操作:Aem 如何从template content.xml文件将两个组件包装到一个div中?,aem,Aem,我有两个组件应该在cq模板中配置,在content.xml文件中(在jcr:content节点中)。 我的模板没有页面组件,因此无法执行以下操作: <div class="wrapper_div"> <cq:include resourceType="/my/first/component"/> <cq:include resourceType="/my/second/component"/> </div> 有没有办法从conte
<div class="wrapper_div">
<cq:include resourceType="/my/first/component"/>
<cq:include resourceType="/my/second/component"/>
</div>
有没有办法从content.xml中定义div容器 有一个技巧,您可以将下面的内容添加到模板的content.xml文件中
<jcr:content
jcr:primaryType="cq:PageContent"
sling:resourceType="path/of/page/page-component">
<par
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys">
<simple
jcr:lastModified="{Date}2015-05-05T12:16:19.895+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="path/components/content/component1"/>
<simple1
jcr:lastModified="{Date}2015-05-05T12:16:19.895+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="path/components/content/component2"/>
</par>
</jcr:content>
</jcr:root>
这将使用此模板为页面创建内容节点,但要做到这一点,您必须在呈现页面组件path/of/page/page组件中包含parsys,例如
还有一些其他方法,比如在页面组件下添加cq:template的节点,以预填充组件
希望这会有所帮助。如果您没有用于模板的页面组件,那么您将如何在页面上呈现内容。该模板必须有resourceType。仅为该模板设置了superResourceType,我不想修改与superResourceType对应的页面组件,因为这是特定的。好的……但是包装器div在哪里?您发布的代码正是我使用的代码,但我还希望在包装器div中包含2个组件,我可以在其中设置一些css类。您可以查看页面源代码,了解这些组件的包装器div是什么。这里parsys是包装器组件。你也可以试试。此外,您可能需要更改“感谢您的回答”的名称。在这种情况下,即使没有必要,我也会有一个额外的parsys…最终我们通过css解决了我们的问题,但VDhim的答案也是一个可能的解决方案。