Lately 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­ily want to let the authors decide what com­po­nents they are allowed to use in a par­tic­u­lar Parsys.

How­ever 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 Sidekick!

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­erty, 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­cific parsys, which can be really use­ful when you use dif­fer­ent Parsys for dif­fer­ent pur­poses 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­ally a way around that. You can directly use groups in there as well:

Then it becomes quite obvi­ous that groups should be used as often as pos­si­ble, espe­cially because they are so easy to setup: sim­ply add a “com­po­nent­Group” prop­erty to the root of you com­po­nent and that’s it (see here: /apps/geometrixx-outdoors/components/colctrl for example).

0 comments