DEV Community

Cover image for Bulk Publish
Rajalakshmi
Rajalakshmi

Posted on

Bulk Publish

Greetings, AEM geeks! This Bulk Publish a Replicator Application may be useful if you're an AEM content author who wants to publish a large number of pages with a single button click rather than publishing each page individually.

Purpose

This functionality allows you to publish a large number of pages, as well as the assets included inside those pages, with a single button click.

Existing feature and its limitation

AEM's Activation Tree feature allows for bulk activation/deactivation of pages that are only modified, only activated, or Ignore Deactivated under a specific tree.

Even though it has a lot of features, it's hard to publish certain pages but not others under a tree.

So, following the instructions below, you may use the bulk publish functionality to solve this problem.

Demo

Steps to use Bulk Publish Component

  • Drag and drop Bulk Publish Component in a page
  • Author dialogΒ of the component by specifying the paths of the pages needed to be published

Enter the Page Paths to Publish in the format - /content/trainingproject/en

1_Author

πŸ’‘ Note: There is no need to include the.html extension to the path, such asβ†’/content/trainingproject/en.html

  • To publish the list of pages available and the assets contained within them, click the Publish button.

    Publish Done

  • Yayyy!!! πŸ‘ We can find the pages have now been published in their respective paths successfully πŸ˜‹

3_check

πŸ‘‰ Now let's take a look at the code that makes all of this magic πŸ’« happen.

Back End Code

Replication API

AEM contains a Replication API that allows you to replicate content using code. We can take advantage of this and replicate the Pages.

Activating Page Assets

To search for all Dam Assets, AssetReferenceSearch API is used. It searches in pages for referenced assets.

DamConstants.MOUNTPOINT_ASSETS- Defines common used dam constants and the repository path (mount point) under which asset metadata is stored.

Front End Code

Now we need to make an Ajax call from the UI to process the BulkPublishServlet on the backend when a button is clicked.

AJAX Call

πŸ’‘ On hover, you can find the entire code of both Frontend component and Backend Core.

The Benefits

  • Excludes the complications associated with activation trees.
  • Hassle free publishing of pages
  • Eliminates the need to publish each page from the AEM Sites console separately.
  • Enhances the User Experience

That's just simple πŸ˜ƒ how it is; Thanks for your time people β˜•, keep exploring and enjoy coding πŸ˜‡

I'm always happy to hear your valuable feedback if so, leave a comment πŸ“ or feel free to connect πŸ’­ with me via LinkedIn or Twitter.

Also, fork or raise open issues if any.

Top comments (0)