Restrict Template types to specific projects | Community
Skip to main content
Level 4
Oct 15, 2018 8:16 PM UTC
Solved

Restrict Template types to specific projects

Hi,

I want to restrict template-type to be available in specific project folder under /conf. It should not be available in other folders for creating the templates. How  can I achieve this?

Thanks,

Rajeev

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Oct 16, 2018 5:06 PM UTC

You can try to set cq:allowedTemplate property in templates types jar:content node

e.g.

/conf/we-retail/settings/wcm/template-types/empty-page/jcr:content

Definition

[cq:PageContent] > nt:unstructured, mix:title, mix:created, cq:OwnerTaggable, sling:VanityPath, cq:ReplicationStatus, sling:Resource
    orderable
    - cq:template (string)
    - cq:allowedTemplates (string) multiple

Arun Patidar

6 replies

arunpatidar
arunpatidarAccepted solution
New Participant
Oct 16, 2018 5:06 PM UTC

You can try to set cq:allowedTemplate property in templates types jar:content node

e.g.

/conf/we-retail/settings/wcm/template-types/empty-page/jcr:content

Definition

[cq:PageContent] > nt:unstructured, mix:title, mix:created, cq:OwnerTaggable, sling:VanityPath, cq:ReplicationStatus, sling:Resource
    orderable
    - cq:template (string)
    - cq:allowedTemplates (string) multiple

Translate
Arun Patidar
smacdonald2008
Level 10
Oct 15, 2018 9:59 PM UTC

Look at the Weekend example --

ANy template that is developed under this folder is now available when creating an editable template for this site.

Once you define a template under a given folder (like WKND Here) - and you are in that folder in the Template view (ie - http://localhost:4502/libs/wcm/core/content/sites/templates.html/conf/wknd​ ) then all of these templates are available. You cannot restrict beyond that.

Translate
Level 4
Oct 15, 2018 9:48 PM UTC

Hi @smacdonald2008

I know we can restrict the templates that are available when creating any page in any of the path. My question is regarding restricting the template types when trying to create templates. Lets consider below scenario:

/conf/organization/brand-1/template-type/basic-template-type-1

/conf/organization/brand-2/template-type/basic-template-type-2

/conf/organization/brand-2/template-type/basic-template-type-3

No when I navigate  navigate to organization > brand-1  using template console, I just want to see basic-template-type-1 to create templates.

Thanks,

Rajeev

Translate
smacdonald2008
Level 10
Oct 15, 2018 9:43 PM UTC

Look how We Retail is setup - when you click on a We Retail page in site admin - and click Create Page, you only see applicable We Retail Editable Templates.

This is how you can restrict editable templates based on a project.

Translate
Level 4
Oct 15, 2018 9:35 PM UTC

But all the template types from all projects are getting displayed when trying to configure any template. It would have been better if we only see relevant template types when configuring templates.

Translate
smacdonald2008
Level 10
Oct 15, 2018 9:33 PM UTC

You can restrict editable templates like how We Retail is setup.

Translate