Monday 1 July 2019

AEM - Add a button in site console's action toolbar to open pages in disabled mode

In Author instance, sometimes we need to check pages in disabled mode to debug HTML/or to see pages how they will look in the publisher or other then edit, preview, design mode. AEM provides the way how to check pages in disabled mode, following are the ways - 
1. Add wcmmode=disabled querystring in the page url e.g. 
http://localhost:4502/content/mfHTL63/en/demo1.html?wcmmode=disabled
2. Open a page as edit e.g. http://localhost:4502/editor.html/content/mfHTL63/en/demo1.html and then click on page information button, it will show popover menu from there click on 'View as Published', a page will be opened in new tab with the disabled mode.





But if you are using 'View as Published' option frequently then you can add a button in site console to view page(s) in disabled mode in one click. 

Follow below step to add a new button/option :

  • overlay /libs/wcm/core/content/sites/jcr:content/actions/selection using Resource Merger (Overlay Node option from CRXDE).
CRXDE to overlay nodes

  • Create a node i.e 'view' and 'data' node child of 'view' node, as below screenshot

overlayed selection and view & data node
  • add the following properties to view and data nodes
<view
    granite:rel="cq-siteadmin-admin-actions-edit-activator"
    granite:title="View as Published"
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/collection/action"
    action="cq.wcm.open"
    activeSelectionCount="multiple"
    icon="devicePreview"
    target=".cq-siteadmin-admin-childpages"
    text="View"
    variant="actionBar">
    <data
        jcr:primaryType="nt:unstructured"
        href.uritemplate.abs="\{+item}.html?wcmmode=disabled"/>
</view>


That's it. The new option 'View' will be shown in site consoles action toolbar when one or many pages are selected.


View button is added in site console


Enable the View button from package

You can install below package to enable/add view option in sites console in Author mode.
https://github.com/arunpatidar02/demo/blob/master/view-as-published-2.zip

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete

AEMaaCS - Core Component's Children Editor

If you are using core components, you should be familiar with the children-editor for Tabs, Accordion, and Carousel. These components are th...

About Me

My photo
https://www.linkedin.com/in/arunpatidar26/ https://experienceleaguecommunities.adobe.com/t5/user/viewprofilepage/user-id/6786635 https://community.adobe.com/t5/user/viewprofilepage/user-id/12372253 https://forums.adobe.com/people/Arun+Patidar