如何限制 AEM 5.6.1 中可在模板的特定解析系统中使用的组件,而无需在设计模式中选择它们?
最佳答案
在 CRXDE 中,在 /etc/designs/[your design]/jcr:content
下,您可以定义节点来表示您的每个模板及其段落并列出每个允许的组件。
格式是每个模板的节点,其中包含每个 parsys 的节点(均为 [nt:unstructured]
)。
parsys 节点然后有一个 sling:resourceType
定义为 foundation/components/parsys
和一个 components
String[]
的属性(property).例如,查看 Geometrixx 是如何定义的:http://localhost:4502/crx/de/index.jsp#/etc/designs/geometrixx/jcr%3Acontent/contentpage/par
然后你可以通过 VLT 提取它,它被存储为 .content.xml
文件下 etc/designs/[your design]
.
或者,您也可以手动创建该文件。例如。以下将“您的设计”定义为允许“yourTemplate”的“yourParsys”段落上的默认“文本”和“图像”组件。
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:template="/libs/wcm/core/templates/designpage"
jcr:primaryType="cq:PageContent"
jcr:title="You Design">
<yourTemplate jcr:primaryType="nt:unstructured">
<yourParsys
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys"
components="[foundation/components/text,foundation/components/image]"/>
</yourTemplate>
</jcr:content>
</jcr:root>
这允许您跨实例移动此文件(例如,在部署 CRX 包时),这样您就不必单独配置环境以及允许哪些组件也可以通过版本控制进行管理。
关于aem - 限制 AEM 5.6.1 中的组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23275062/