问题描述
如何在AEM 5.6.1中限制可以在模板的特定parsys中使用的组件,而不必在设计模式下选择它们?
How can I restrict the components in AEM 5.6.1 that can be used in a particular parsys of a template with out selecting them in the design mode?
推荐答案
在CRXDE中的 / etc / designs / [您的设计] / jcr:content
下,您可以定义代表每个模板的节点。 &他们的段落和列出每个允许的组件。
In CRXDE, under /etc/designs/[your design]/jcr:content
, you can define nodes to represent each of your templates & their paragraphs & list the allowed components for each.
格式是每个模板的节点,其中包含每个parsys的节点(均为 [nt:unstructured]
)。
The format is a node for each template that contains a node for each parsys (both [nt:unstructured]
).
然后parsys节点具有 sling:resourceType
定义为 foundation / components / parsys
以及 String []
的 components
属性。例如,查看如何定义Geometrixx: http:// localhost:4502 / crx / de / index.jsp#/ etc / designs / geometrixx / jcr%3Acontent / contentpage / par
The parsys node then has a sling:resourceType
defined of foundation/components/parsys
and a components
property of String[]
. For an example, check out how the Geometrixx one is defined: http://localhost:4502/crx/de/index.jsp#/etc/designs/geometrixx/jcr%3Acontent/contentpage/par
然后您可以通过VLT提取此文件,该文件存储为 .content.xml
在 etc / designs / [您的设计]
下的文件。
You could then extract this via VLT, which gets stored as a .content.xml
file under etc/designs/[your design]
.
或者,您可以手动创建该文件,太。例如。以下将您的设计定义为允许在 yourTemplate的 yourParsys段落上使用默认的文本和图像组件。
Alternatively, you can create that file by hand, too. E.g. the following would define 'Your Design' as allowing default "text" and "image" components on the "yourParsys" paragraph of "yourTemplate".
<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软件包时),这样您就不必单独配置环境了。哪些组件是允许的,也可以通过版本控制进行管理。
This allows you to move this file across instances (e.g when deploying a CRX package) so that you don't have to configure environments individually & which components are allowed where can also be managed by version control.
这篇关于限制AEM 5.6.1中的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!