Late­ly I’ve had a few devel­op­ers come to me with the same ques­tion: how do you set the default com­po­nents appear­ing in the Side­kick when first open­ing a page?

It’s a legit­i­mate ques­tion, switch­ing to Edit mode for every page can be quite annoy­ing, and we don’t nec­es­sar­i­ly want to let the authors decide what com­po­nents they are allowed to use in a par­tic­u­lar Parsys.

How­ev­er this is quite easy to fix, and here is how.

When build­ing your web site with CQ, you will define a clientlib to store all your graph­i­cal assets (JS, CSS and images) as described in this post. But what devel­op­ers often over­look is the fact that you can also use the clientlib to store meta infor­ma­tion, like the list of default com­po­nents appear­ing in Side­kick!

To see an exam­ple of this nav­i­gate to /etc/designs/geometrixx-outdoors/jcr:content/page/par in crxde and look at the prop­er­ties of the node:

Here you see we are using the “com­po­nents” prop­er­ty, and we’re sim­ply list­ing the com­po­nents we want to see appear­ing in the side­kick when we open a page using the page com­po­nent defined in our Geometrixx Out­doors appli­ca­tion (this one: /apps/geometrixx-outdoors/components/page), this will also restrict the num­ber of com­po­nents your can drag and drop in this spe­cif­ic parsys, which can be real­ly use­ful when you use dif­fer­ent Parsys for dif­fer­ent pur­pos­es on the same page. Sim­ply put the path of each com­po­nent in this String array and voila!

One more thing though: you might argue that hav­ing to list every sin­gle com­po­nent in there is a bit annoy­ing, but there’s actu­al­ly a way around that. You can direct­ly use groups in there as well:

Then it becomes quite obvi­ous that groups should be used as often as pos­si­ble, espe­cial­ly because they are so easy to set­up: sim­ply add a “com­po­nent­Group” prop­er­ty to the root of you com­po­nent and that’s it (see here: /app­s/­ge­ometrixx-out­doors/­com­po­nents/­colctrl for exam­ple).