What is the use of designDialogPath? - aem

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.

Related

How to add custom layout to page fragment in Liferay 7.3

I have followed this tutorial https://help.liferay.com/hc/en-us/articles/360018167031-Creating-Layout-Templates to create custom layout for Liferay 7.3. After deploy the layout to the Liferay manually using app manager, I'm not able to find the custom layout in Fragment and Widget option.
When I check in Global Menu > Control Menu > Components > Layout Templates. I'm able to see my custom layout.
Did I missed anything or is there any other way to add custom layout to Fragment and Widget options?
Thanks
You missed one crucial info: "Layout Templates" are only applicable to pages of the type "Widget Page" (the default and pretty much only page layouting method in Liferay 6 and earlier). "Page Fragments", on the other hand, are only applicable to pages of type "Content Page" (which came up somewhere between 7.0 and 7.3). You set the type of a page at the moment you create them, by selecting one of the corresponding page templates.
So, if you want to create a certain row/column layout as a template for your "Content Page", you may want to look into the page fragment type "section". Basically, you'll be creating a Page Fragment that incorporates some <lfr-drop-zone id="invent-your-own-id"></lfr-drop-zone> tags in its HTML. Documentation on dropzones is very sparse at the moment (best source I found is Liferay's issue tracker plus experimenting yourself), but as this tag currently does not allow more attributes than id, you can simply experiment with it.
(Side notes: Due to some arcana in some standard documents, you cannot use the self-closing form of the <lfr-...> tags, so <lfr-drop-zone id="abc" /> will fail silently. Also, remember that the HTML part of a page fragment actually will be interpreted as an FTL template using Freemarkers alternative syntax before the <lfr-...> tags are interpreted., which gives you the option of placing a configurable amount of dropzones using a loop.)
But: take a moment to check whether you really need a custom "dropzone layout", as Liferay already provides you with a configurable "row section" in the content page editor; and anything more complex will give you headaches when making it responsive.
We are going through this exact same situation. Up until 7.1, we used Layout Templates on Widget Pages to enforce a consistent design over our Org's Intranet, while still having per-Department Authors (see Herding Cats).
New requirements, including the Users overall desire to have more control over page layout and simplified editing, as well as personalization (using Segments), are forcing us to implement the features of Widget Pages (and Layout Templates) in Content Pages. So far, Page Fragment Sections (as #orithena suggested) are giving us a path forward.
Now, we're developing for 7.2. 7.3 seems to be taking this concept even further, with the afformentioned drop zones, nested row layouts, and Master Pages.

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

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.

How to change the website look and feel by changing the design location under page properties

I have a requirement where I have 2 clientlibs having different CSS files for my website. The business author should be capable of switching the website look and feel by just changing the path of the design under page properties. While I am able to achieve that requirement by changing the clientlib categories name referred in my JSP of base template of my site, can the same thing be achieved by the business author without actually performing a code level change? Basically, he should be able to select the design path present under the page properties section, and selecting a different design should change the look and feel of the website. Please let me know how this can be achieved.
Note: I have placed my clientlibs under /etc/design/proj-name/ path
The foundation page component is designed to include css link in the head if a file called static.css is present under the design. It's done through the design object.
If you have different css in the static.css file under different designs then the look and feel will change with the design. However you will be stuck with one file and cannot leverage the utility of client libs.
This adobe doc suggest's doing something like this for css and related images
<%= currentDesign.getPath() + "/static/img/icon.gif %>
Data from design dialogs is stored under the design , swapping designs to change look and feel will cause data inconsistencies too.
Why not add a selection widget to the page and use it's value to selectively include different client lib categories instead of relying on the design.

Limiting allowed components in a template in cq5

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.

How to add CSS, Images to a page in CQ5?

I am creating a new template and then a page from SCRATCH in CQ5. But I can't find the option to add my own CSS/images/JS to the page.
I mean a place to add/upload the actual files.
All the tutorials I've seen talk only about creating a template based on an existing template. Is there any tutorial on how to create the page from scratch ?
Your CSS and JavaScript go into nodes under /etc/designs/[your project's name]/clientlibs. (Ordinarily, you would set the page property cq:designPath of your content's home page to be /etc/designs/[your project's name] to point to this.) It's common practice to set up a subfolder of clientlibs called default, where your general-purpose style sheets and JavaScript go; you can set up other clientlibs for special-case script and style sheets. The simplest way to incorporate your script and style sheets into your page template is the <cq:includeClientLib> JSP tag.
The Adobe docs on clientlibs will also be useful to you, and explains how to use the tag.
#David , thanks for your answer, but for now, I got a better way to add and then use external files using WebDAV with CQ5.
The basic integration of WebDAV with CQ5 application is mentioned in this page