Hi @alisyed1
What you can do for this is create a Sling Event Handler and bind it to replication event on publish.
This will get called every time a page is replicated to the publisher.
Here you can write the logic to modify the page replicated as you please:
Here is sample code of how you can register such a Handler on AEM Publish instance.
@Component(service = EventHandler.class,
immediate = true,
property = {
Constants.SERVICE_DESCRIPTION + "=Listener on page replication",
EventConstants.EVENT_TOPIC + "=" + ReplicationEvent.EVENT_TOPIC
})
public class OnPublishReplicationEventHandler implements EventHandler {
@Override
public void handleEvent(final Event event) {
//write your logic here
}
}