Components in AEM 6.0 can have the properties: cq:template
and cq:templatePath
. As I am working not both are required always but I don't get the exact difference between these two.
cq:template
has the type nt:unstructured
, it allows you to define a complex node with a set of properties and children. It's a node you create as a child of your component definition. This content will be used as default values whenever you drop a new instance of the component from the sidekick.
Here's an example. componentA
has a child called cq:template
of the type nt:unstructured
. The cq:template
node can have multiple properties and even other nodes as children in case if you need to aggregate some of the properties. Here's how it would look in CRXDE
cq:templatePath
has the type String
, it's a simple property, the value of which allows you to point to a node much like one you'd create when using cq:template
, except it's located elsewhere. Just set it to the path of the node that you want to use as the actual content template definition.
If there's a common pattern in the content used by multiple components, you can define the template in a single place and use cq:templatePath
to reuse it. If the content is specific to a single component, define it using cq:template
Here, cq:templatePath
is just a property of the node corresponding to the componentA
component. Its value points to a different node in the repository that contains the actual content to be used as the template. The structure of the other node is the same as in the previous example.
You can find more information in the documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With