Expand my Community achievements bar.

SOLVED

How to add a custom page property tab on a particular template, how to achieve this can any one help

Avatar

Level 3

I have created a custom tab in cq: dialog of page component, Now i wish to allow the custom page property tab on a particular template not on every template. 

Anilkumar9_0-1706625938063.png

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Community Advisor

Hi @Anilkumar9 


Update Component Dialog:

Open the dialog for your page component (located at /apps/<your_project>/components/content/page/dialog).
Add a Template-specific Condition:

Inside the dialog XML, find the <cq:dialog> node that represents your dialog.
Add a cq:template node inside the cq:dialog node with the jcr:primaryType set to nt:unstructured.
Use the sling:resourceType property to specify the path to your custom tab implementation. This will ensure that the tab is only included when the page is based on the specified template.

<cq:dialog jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog">
...
<cq:tabs jcr:primaryType="nt:unstructured">
...
<yourCustomTab
jcr:primaryType="cq:Widget"
sling:resourceType="your/project/components/content/page/dialog/customTab"
cq:showOnTemplate="/apps/your/project/templates/yourTemplate"/>
...
</cq:tabs>
...
</cq:dialog>
Replace /apps/your/project/templates/yourTemplate with the path to the template where you want your custom tab to appear.

Replicate the Configuration:

If you have multiple templates where you want the custom tab to appear, replicate the <yourCustomTab> configuration inside the <cq:tabs> node for each template.



Avatar

Community Advisor

You have overridden the default page dialog. Your every template pagetype is created form this page. Thats why you are getting the dialog on every template.

There is two way

One:
Templates are always based on a page. So go to the pagetype of your template. Now override the dialog here instead of overriding on default page.

Two:

Go to each template and create cq_dialog/content.xml. Then just configure which items you want to hide.
Check the screenshot

kaikubad_2-1706680883243.png

 

Avatar

Administrator

@Anilkumar9 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni