Expand my Community achievements bar.

SOLVED

Unpublishing heiarcy question

Avatar

Level 1

If I had a parent folder that has say 5 children pages.  If one of those children pages gets deleted but was never unpublished, would unpublishing the parent folder unpublish itself and all 5 children or only the 4 that remain leaving an orphaned child published?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @ryant58768566 
Please check, when you delete the page , its get unpublished automatically.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-ideas/delete-page-in-autho... 



Arun Patidar

View solution in original post

4 Replies

Avatar

Community Advisor

In AEM - General rule or scenario:

When you unpublish a parent page, it attempts to unpublish all of its child pages as well.

 

In the above your scenario - as the child page is deleted (without unpublished) - it will be remain available in Publish instance (remain published) , even after the parent page is unpublished.

because the Unpublished action will not find the deleted child page in author instance parent child structure.

 

- deleted page still available in publish instance.

Best way is - test this scenario in Development or QA environment.

Avatar

Community Advisor

@ryant58768566 not sure if you have any customizations.. but ideally when ever you delete any page in AEM author.. it unpublish and deletes the page.. so there is no chance of page getting deleted in author and present in publisher..

 

 

Avatar

Level 10

@ryant58768566 This same problem I just had in my project if we are publishing data to third party API. @arunpatidar  Agree with Arun, on deletion, it will unpublish the page.

If require for third party, use below code to unpublish page data as soon as it gets delete.

 

import com.day.cq.replication.ReplicationAction;
import com.day.cq.replication.ReplicationActionType;
import org.apache.commons.lang3.StringUtils;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

import java.util.*;

@Component(service = {EventHandler.class, ManagePages.class}, property = {
		EventConstants.EVENT_TOPIC+"="+ReplicationAction.EVENT_TOPIC }, immediate = true)
public class ManagePages implements EventHandler {

	// main logic to handle specific AEM events for iPaas integration
	public void handleEvent(Event event) {
		String eventTopic = (String) event.getProperty(EventConstants.EVENT_TOPIC);
		List<String> agents = (List<String>) event.getProperty("agentIds");
		if (StringUtils.isBlank(eventTopic) || agents.contains("preview")) {
			return;
		}

		// logic to get the page path for replication events
		ReplicationAction actionType = ReplicationAction.fromEvent(event);
		if (null != actionType) {
			if (!ReplicationActionType.DELETE.getName().equalsIgnoreCase(actionType.getType().getName()) {
				// unpublish page using Replication API
			}
		}
	}
}

 

 

Avatar

Correct answer by
Community Advisor

Hi @ryant58768566 
Please check, when you delete the page , its get unpublished automatically.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-ideas/delete-page-in-autho... 



Arun Patidar