Reputation: 57
I need to create the following model pages(in localhost:4502/siteadmin):
Basepage
|
Homepage
|
Contentpage1
|
Contentpage2
Basepage - main page, can create only the homepage
basepage template .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>
Homepage - can create any page(except basepage) but only homepage can create contentpage
homepage template .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 - it can be created only on the homepage or contentpage, and contentpage can create only contentpages
contentpage template .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>
I'm trying to implement these requirements with the aid of the parameters allowedParents and allowedChildren, but unfortunately it does not work
Contentpage not see the template contentpage (can't create Contentpage2): https://i.sstatic.net/quHN4.jpg
What am I doing wrong?
Upvotes: 0
Views: 4353
Reputation: 57
This is a working version! But we must be careful not to put the space
allowedParents="[/apps/powerade/templates/homepage, /apps/powerade/templates/contentpage]" (don't work)
allowedParents="[/apps/powerade/templates/homepage,/apps/powerade/templates/contentpage]" (works!)
Upvotes: 3