AEM CQ 561 - Hide Sidekick

Goal


Hide the Sidekick in page authoring, just in case you need to :)

Solution


In you page component jsp add the following script

<script type="text/javascript">
    (function(){
            CQ.WCM.on("editablesready", function(){
                CQ.WCM.getSidekick().hide();
            });
    })();
</script>

An other way is to add the js logic in a client lib

1) Login to CRXDE Lite (http://localhost:4502/crx/de) and create folder /apps/hide-sidekick

2) Create node /apps/hide-sidekick/clientlib of type cq:ClientLibraryFolder and add a String property categories with value experience-aem.sidekick

3) Create file (nt:file) /apps/hide-sidekick/clientlib/js.txt and add

                       hide-sidekick.js

4) Create file (nt:file) /apps/hide-sidekick/clientlib/hide-sidekick.js and add the following code

(function(){
    if( ( window.location.pathname == "/cf" ) || ( window.location.pathname.indexOf("/content") == 0)){
        CQ.WCM.on("editablesready", function(){
            CQ.WCM.getSidekick().hide();
        });
    }
})();

5) Include the clientlib in your page component jsp

                     <cq:includeClientLib categories="experience-aem.sidekick"/>

No comments:

Post a Comment