Defaults in your CQ5 component
When you have read my post around default components in your parsys then if you take it a step futher you want to have also defaults at component level.
In this post I will take the Text & Image component and will make the following changes when you drag this component onto your page:
- There is already a default text
- An image is already pre-filled
Component
We start by using the Text & Image component in a content page and specify a value for the Text and drop an image in the component.
I have used one of the default images from the Geometrixx application.

Nodes
After you added the component to the page and the values are specified, go to CRXDELite and look at the nodes created for the Text & Image component.
You see a "textimage" node with a childnode called "image" where the image details are stored. At the level of "textimage" the text is specified.

Changes
Before we can make any changes we will overlay the default Text & Image component, this is located in /libs/foundation/components/textimage.
Create a folder structure "foundation/components" in the "apps" folder and copy the default component in that location.

Trick
Ok, here comes the trick. Create a node cq:template of the type nt:unstructured under your component.
In the node add the two properties from the "textimage" node
- "text", value "<p>This is some text</p>"
- textIsRich, value "true"

Now copy the "image" node (from the contentpage) so that is a child of the cq:template node.

Test
To test the changes make sure you have saved the newly created nodes and you have refreshed the content page.
When you now drag/drop the Text & Image component on your page you see it contains a default text and a default image.
This all done by creating nodes, not by coding!
Feike Visser (twitter: @heervisscher)
I experienced the same behavior when I changed node type to cq:template, and the behavior ceased as soon as I deleted this node.
Has anyone else experienced this? I'm using CQ 5.4
For example, my component "Big Component" does a cq:include of "small component"
small component has various properties. I would like to in "Big Component" provide a default "small component" and defaults on those properties, but that only apply to "Big Component".
It does not seem to work to add a "small component" node to cq:template, and it doesnt appear that you can add it to the jcr:content node under bigComponent.jsp either. Any thoughts?
We have all the best and newest styles of Epi Leather Handbags that you want to look at ---all the best of the Fall and Winter fashions!