Component may be added only to a specific page(in specific parsys) - aem

I have homepage(has parsys) and contentpage(has parsys). I have a SimpleTextComponent component. I want to this component be used only in page contentpage(only in contentpage parsys). How can I do that?
(It is also advisable not to show a component in the Sidekick for other pages, only contentpage.)

You can set this in Design Mode. When you edit the template that is used for your contentpage, you can change the parsys on that template to allow the use of your SimpleTextComponent. You govern which components are available on a template-by-template basis, so as long as other pages use different templates you will be able to configure those templates differently.
This article outlines how to use Design mode to set which components are available. This page has a tutorial.
Also see Restrict the components in AEM 5.6.1.

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.

How to use the reference component in AEM Template

am having a requirement to use a common content in all the pages. So I decided to use the reference component in AEM. I have created a new page and authored the content. How can this content can be used in the templates, so that it will appear in all pages without re-authoring.
As you are using AEM 6 version, you can utilize the concept of design dialogs in components in static templates. You create a component, add design dialog and choose the fields in the design dialog, which once is authored will reflect in all pages created with that template.
The only activity you have to do while authoring is, you need to add and author the component in a page created with specific template.
If you are using the AEM 6.3 or more, Experience Fragments can be used, you can configure the experience fragment in the template and can be seen across all the pages.
You can use the experience fragment in individual pages as well.
https://docs.adobe.com/content/help/en/experience-manager-learn/sites/experience-fragments/experience-fragments-feature-video-use.html

Design Dialogs for different locales in a multi-locale site

How to change design dialog content in specific locale?Example the design specific constructs that would be different accross locales were logo, branding elements etc... Please suggest various alternatives and best approaches?
Design dialog are not locale or site specific in case of multisites rolled out on same instance of AEM. Design dialog properties gets stored on template/component basis in designs (/etc/designs/<your-site>/jcr:content/<path/page component name>/<component>). You can look at the sample for geometrixx site # /etc/designs/geometrixx/jcr:content/page/logo
For the scenarios where in the content/imagery that needs to change per site/locales you should use normal dialogs.
For components like header and footer which needs to stay consistent across site and usually the requirement is that they should be authored once and not be edited every time a new page is created, you could use iparsys component for the inheritance of these sections to pages in the hierarchy. This would require the inheritance system to be setup on a base page/template from which other templates extend so that inheritance get extended to all templates.

Adobe CQ - CQ5 - Limit a component to only being usable on a given page template

I am developing components for CQ5 and wish to control them so that component A is only displayed in the sidekick if the page is of template T_A, and components B and C are only visible if the page is of type template T_B, however I have so far not been able to find a set of properties to allow this.
Does anyone know of any way to achieve this functionality?
I am also able to retrieve the page template in code via the use of
currentPage.getProperties().get("cq:template", "").equals(MyTemplate) however, once I have not been able to find a way to control sidekick component visibility.
I have also attempted variation on Disabling The Components Tab, however this too has met with no success (even at the level of disabling the entire components tab).
This feature is baked into CQ5 and requires no special coding. The general way of controlling what components are visible in the side kick (specially what components are allowed for a given parsys) is controlled via a design. The remainder of my answer is based on the assumption that you have no special requirement other than controlling what components are allowed for a parsys (i.e no run time requirements).
The components (or component groups) allowed for a parsys are stored in the design of the site . You can control this behavior by editing the design dialog of the parsys.
The steps for achieving this are as follows
Go to design mode by clicking on the ruler icon at the bottom of the side kick
Click on edit button of the required parsys
Check the components required from the allowed component list
The allowed components are stored on per template basis. Since this data is stored in a design , all the pages must have the same design. The design must be exported too, for this to work across instances [ref : https://stackoverflow.com/questions/17049259/limiting-allowed-components-in-a-template-in-cq5
]

Creating a responsive design using CQ5 templates

I'm investigating Adobe CQ5 and would like any advice on how to integrate its drag-and-drop UI to create a responsive website. It seems as if it works on a concept of fairly bland templates with components that can be dropped in pretty much anywhere, including things like "three-column control" - which would make designing a responsive grid structure very hard (as it would be hard to prevent users from dropping in a control that could ruin the layout).
Does anyone have any experience or advice on this? I'm really looking for deep technical details on the structure of templates vs components (paragraphs), and where/how to manage to the CSS.
CQ5 offers ways to control what can be done within a template, so thinking that components "can be dropped in pretty much anywhere" may be misleading. Page templates are designed and configured so that you control which components can be added to a certain area of a page. This allows you to only make those components available that will work with the template layout, excluding components that would wreck the layout. Then authors are only allowed to use things that will work. If they attempt to drag a component onto a paragraph (parsys) where that component has not been configured as available, the UI will not allow them to use it there. So CQ actually makes it easy to prevent users from dropping a control somewhere that would ruin the layout.
This is outlined a bit here:
http://dev.day.com/docs/en/cq/current/howto/components_develop.html#Adding%20a%20new%20component%20to%20the%20paragraph%20system%20%28design%20%20%20%20%20mode%29 which states that
"The components can be activated (or deactivated) to determine which
are offered to the author when editing a page."
When it comes to CSS and JavaScript, you can create a client library and then include the relevant client library on the page. Backend CQ functionality will take care of combining multiple CSS (or JavaScript) files into a single minified file to allow for a single HTTP request of an optimized file. This it outlined a bit here:
http://dev.day.com/docs/en/cq/current/developing/widgets.html#Including%20the%20Client-Sided%20Code%20in%20a%20Page as well as
http://dev.day.com/docs/en/cq/current/howto/taglib.html#%3Ccq:includeClientLib%3E
So you might develop several components that share a client library, then when any of the components is added to a paragraph the client library will be included on the page. You may also want a CSS library that applies to all the templates to give a common look and feel, yet allow components to add their own when they are used.
These guidelines for using templates and components outline how you provide control, yet flexibility:
http://dev.day.com/docs/en/cq/5-5/developing/developing_guidelines_bestpractices.html#Guidelines%20for%20Using%20Templates%20and%20Components
I'll document our successful WIP experience with RWD and CQ5
Assumptions:
A well documented style guide.
Our First Steps:
Modified existing column control component css to utilize twitter bootstrap grid css.
Create a base page property allowing two different classes on the grid container to be set and inherited by child pages. (container||container-fluid).
Leverage out-of-the-box components where ever possible.
All component widths inherit the width of their parent container allowing for components to be dropped into any location within a template.
Issues:
The out-of-the-box column control component can not be nested.
We are looking into building a custom column control component.
Takeaways: this is an evolutionary project and we are constantly iterating.
With the recent launch of AEM 6.0, they have an example website called as Geomatrixx Media. This website is responsive.
You can take this example as reference and start building on top of it.