2015-10-05 51 views
0

我需要建立以下模型页面(在本地主机:4502/siteadmin):AEM CQ allowedParents和allowedChildren性能

Basepage 
    | 
    Homepage 
     | 
     Contentpage1 
      | 
      Contentpage2 

的BasePage - 主网页,只能创建主页

的BasePage模板.context.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<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" 
jcr:primaryType="cq:Template" 
jcr:title="Base site" 
jcr:description="" 
allowedPaths="[/content]" 
ranking="{Long}100"> 
<jcr:content 
    cq:designPath="/etc/designs/basesite" 
    jcr:primaryType="cq:PageContent" 
    cq:allowedTemplates="[/apps/powerade/templates/homepage]" 
    sling:resourceType="foundation/components/redirect"/> 
</jcr:root> 

首页 - 可以创建任意页面(BasePage的除外)但只有主页可以创建contentpage

网页模板.context.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<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" 
jcr:primaryType="cq:Template" 
jcr:title="Homepage" 
jcr:description="Homepage" 
ranking="{Long}100"> 
<jcr:content 
    jcr:primaryType="cq:PageContent" 
    cq:allowedTemplates="[/apps/powerade/templates/.*]" 
    sling:resourceType="powerade/pages/homepage"/> 
</jcr:root> 

Contentpage - 它只能在主页或contentpage创建,并contentpage只能创建内容网页

contentpage模板.context.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<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" 
jcr:primaryType="cq:Template" 
jcr:title="Contentpage" 
jcr:description="Contentpage" 
ranking="{Long}99" 
allowedParents="[/apps/powerade/templates/homepage, /apps/powerade/templates/contentpage]" 
allowedChildren="[/apps/powerade/templates/contentpage]"> 
<jcr:content 
    jcr:primaryType="cq:PageContent" 
    cq:allowedTemplates="[/apps/powerade/templates/.*]" 
    sling:resourceType="powerade/pages/contentpage"/> 
</jcr:root> 

我试图通过参数al lowedParents和allowedChildren,但遗憾的是它不工作

Contentpage看不到模板contentpage(不能创建Contentpage2): http://i.stack.imgur.com/quHN4.jpg

我在做什么错?

回答

2

这是一个工作版本!但我们必须注意不要放置空间

allowedParents="[/apps/powerade/templates/homepage, /apps/powerade/templates/contentpage]" (don't work) 

allowedParents="[/apps/powerade/templates/homepage,/apps/powerade/templates/contentpage]" (works!) 
相关问题