Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Design .content.xml node writing guidelines for components (Sling ressource type path)?

Avatar

Level 1

Hi @all,

sorry, for rusty english. I'll do my best ;).

Given example: a node from the designs .content.xml:

<stage jcr:primaryType="nt:unstructured" sling:resourceType="ORG/components/stage" dontUseTargetValues="true" hideTargetValuesPolicy="[jcr:description]" stage.renderMode="general"> <par jcr:primaryType="nt:unstructured" sling:resourceType="foundation/components/parsys" components="[/apps/ORG/components/image,/apps/ORG/components/teaser,/apps/ORG/components/text/textimage]"> </par> </stage>

If the components increase (in combintaion with the Sling ressource type path), the readability of this line will decrease. This will become very difficult and hard to maintain. Is it allowed to write those "components" lines like this?

<stage jcr:primaryType="nt:unstructured" sling:resourceType="ORG/components/stage" dontUseTargetValues="true" hideTargetValuesPolicy="[jcr:description]" stage.renderMode="general"> <par jcr:primaryType="nt:unstructured" sling:resourceType="foundation/components/parsys" components="[ /apps/ORG/components/image, /apps/ORG/components/teaser, /apps/ORG/components/text/textimage ... etc. ]"> </par> </stage>

Is AEM/CRX able to interpret those lines correctly? Is this a valid way to write this XML node entry?

Thanks for your help and any suggestions.

Eddie (Greetings from germany)

1 Accepted Solution

Avatar

Correct answer by
Level 5

Go ahead and try it, but my guess is that it will not work. I know if you put a space between the comma delimited list items, it will not work. And, unfortunately the almost silent failure is that the property just simply isn't set in CRX. You'll need to pay close attention to whether your XML file was appropriately deployed as nodes/properties.

Are you aware of component groups? The best practice is to place your components in groups, then specify which groups are allowed in the design. That allows you to keep things much simpler and you don't have to add components to the design every time (as long as they are in the group).

On the component definition itself set the property "componentGroup" to whatever value...typically one group that corresponds with the name of your site/organization is enough. Then in the "components" property on your paragraph system node in the design configuration, instead of using a path to a component, specify "group:MyGroup". Then all components in that group will be allowed, per the design.

Note, I've also had issues with line delimiting the XML namespace declarations for a .content.xml file. When I do that it will deploy an nt:file node called .content.xml instead of translating them to JCR nodes.

You may want to double check my syntax - it's off the top of my head - but component groups should help you clean things up.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 5

Go ahead and try it, but my guess is that it will not work. I know if you put a space between the comma delimited list items, it will not work. And, unfortunately the almost silent failure is that the property just simply isn't set in CRX. You'll need to pay close attention to whether your XML file was appropriately deployed as nodes/properties.

Are you aware of component groups? The best practice is to place your components in groups, then specify which groups are allowed in the design. That allows you to keep things much simpler and you don't have to add components to the design every time (as long as they are in the group).

On the component definition itself set the property "componentGroup" to whatever value...typically one group that corresponds with the name of your site/organization is enough. Then in the "components" property on your paragraph system node in the design configuration, instead of using a path to a component, specify "group:MyGroup". Then all components in that group will be allowed, per the design.

Note, I've also had issues with line delimiting the XML namespace declarations for a .content.xml file. When I do that it will deploy an nt:file node called .content.xml instead of translating them to JCR nodes.

You may want to double check my syntax - it's off the top of my head - but component groups should help you clean things up.