Limiting allowed components in a template in cq5 - aem

I have a template that I want to limit to only using a certain subset of components. I've created the template, set the components I want to use in design mode and everything looks great, but when I export that template and install it on another cq5 instance the component list that I've set for that template vanish. Any idea how to get them to stick?

The above answer is correct, but if you need more info, as part of the template implementation, you can define the list of components that will be rendered in the sidekick for your template by defining the following property.
components="[/libs/foundation/components/text,/libs/foundation/components/textimage]">
This will sit under the following node (xml format here)
<TEMPLATENAME jcr:primaryType="nt:unstructured">
<content
jcr:lastModified="{Date}2014-04-11T13:04:48.855+10:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="/libs/foundation/components/parsys"
components="[/libs/foundation/components/text,/libs/foundation/components/textimage]">
</content>
</TEMPLATENAME>
As long as you take this with your project to another instance, you'll keep the settings.
always take /etc/designs/projectDesignName directory with you

The component list is saved in your design page. A design page is a page of a "Design Page" template. You should create one for each site / project, and associate it with your page (or page's parent, or page parent's parent) using the page properties: Advanced -> Design, and then export alongside your template.

Related

Is it possible to have a container prepopulated with a specific component through a prototype page in Hippo CMS / brXM?

In an attempt to set up a new page with a single vbox container I'm able to get the container to show in the Channel Manager but this requires the CMS editor to add all of the individual components by hand. Alternatively we can place components directly on the page and through the configuration in the prototype but that does not allow the CMS editor to edit the component configuration (Info) or associate a document. The question is then, in an attempted compromise, is it possible to repopulate the container with a specific component so that the the CMS editor is provided a default set of components in the containers when creating a new page from a prototype/template page?
I believe the key term you are looking for is hst:prototypepages
Their documentation can be found at https://documentation.bloomreach.com/14/library/concepts/hst-configuration-model/prototypepages-configuration.html but basically you can define the prototype having certain components already on the page - and possibly even default settings for those components.
A similar concept at the component level is the hst:catalog
You can define "component prototypes" with default settings for when they are placed onto a page.

What is the use of designDialogPath?

I am seeing from wcmcore page component,
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Page (v1)"
sling:resourceSuperType="wcm/foundation/components/basicpage/v1/basicpage"
componentGroup=".core-wcm"
designDialogPath="core/wcm/components/page/v1/page/cq:design_dialog"/>
What is the purpose of designDialogPath? My dialog from page policy works even without this property. I couldnt realize the difference adding and not adding this property.
Can you please point the purpose of this property?
What designDialogPath path does?
In the context of wcm core component, designDialogPath enables you to access Page Design mode from the template in /conf folder. Screenshot below.
When you remove this node, you will not be able to access Page Design from the template. That option does not show up. Screenshot below.
Why include designDialogPath?
It's primary use is to define clientlibs that should be loaded for pages using this template. Adobe has added an helpPath in that component to explain this. Link here.
There are use cases where the same page needs to be rendered differently in terms of styling and as a developer, you can define different clientlibs for different layouts and leave it to the author to inject the required clientlibs based on the use case.
I feel this is just another step by Adobe to give more control to content authors.

Deleting, Moving pre defined components from template in Adobe AEM

I have requirement where, in template we will have some list of components by default. But the requirement is, author can delete,move these components in the page.
We are using sightly and I have used
<div sly data-sly-resource="${'sample' # resourceType='sampleapp/components/content/sample'}" />
This is working fine. But I am not sure how do to delete and move this component.
Any help is appreciated.
If you have a template/component in which you include a specific component then it cannot be moved or deleted. It will show the delete option but after refresh it will be there again (not configured). The things that can be moved are components placed within parsyses.
To create template which has predefined components that can be then moved around you need to base your structure on parsyses. Place your predefined components within the templates parsyses - within the templates jcr:content. Remember that template is nothing else then a predefined content node.
See the example in which the survey-template has predefined content:

how properties are stored in /etc/designs for design dialog

I'm new to CQ5 and working on a project that deals with refactoring code that uses design dialogs.
Currently, I have a property declared as part of design dialog of my component. It creates a folder in /etc/designs/ for each template my component is used on. Is there a way we can make sure that those property values are stored at one particular configuration in /etc/design(as opposed to multiple)? I need to make sure only one set of configurations is used for all pages that use my component.
Thanks in advance!
Pallavi
The designs are linked to the template and not the whole site.
Hence whenever you configure the component in design mode, the values are stored within the corresponding template under the jcr:content of the configured design page or under /etc/designs/default/jcr:content in case no design is configured.
As far as I know, there is no way to tell AEM to store all the design configurations under one single path, unless you are using absolute paths in your dialog / page configurations.
If you are using multiple templates in your site, there must be one master template (which render global components eg. header/logo/navigation & footer), and all other templates should extend master template to get these global components and change pagelayout for content section.
Saying so, if templates are structured & inherited properly, you should be able to set design dialog property on home page (created using master template) and all internal pages will be able to access those design property OOB. Though child pages (created using other template) can override those design property (if needed for that template) to break inheritance.

Why exactly templates are needed in CQ?

Why exactly do we need templates when all a template does is to have a resourceType property attached to a content-page component.
At the time of creating new page, shouldn't authors directly select that component instead?
The template nodes define the metadata for the page that will be created, one aspect of which is the underlying resource type (i.e. the Page component that will be used to render out the content).
Some example of other things configured at a template level include:
The default content that is included when the page is created. This
is stored under the template node itself, i.e. in /apps/[your-site]/templates/homepage.
For example, you could add a carouselnode underneath the homepage node, to ensure that any page created with the homepage template will have a carousel node added by default.
The allowed parents & children of the template — e.g. configuring the homepage template so that it can't be placed beneath other templates.
The allowed components in each parsys — In /etc/designs/[your-design]/jcr:content, you can defined what components can be added to a particular parsys, which applies to any page using that template.
By having a separation between templates & page components it allows us to re-use the same renderers (e.g. JSP scripts), but have aspects like these configured differently for different templates.