Question
cq:lastReplicationAction not usable on AEM Publish/Dispatcher - component renders empty
Hi ,
I am working on a requirement where a custom sling model needs to exclude pages that are unpublished/hidden from navigation, while recursively walking a page tree vis listchildren(). The issue driving this: page that are hidden in nav, unpublished and have a redirect configured still showing up in the list. so we need to explicitly hide unpublished pages, not just hidden ones.
To fix this, I check cq:lastReplicationAction/cq:lastReplicationAction_Publish on each pages’s ValueMap to filter unpublished ones.
Resource contentResource = childPage.getContentResource();
if (contentResource != null) {
ValueMap properties = contentResource.getValueMap();
isHidden = properties.get("hideInNav", false);
isPublished = properties.get("cq:lastReplicationAction", String.class);
isPublishedDispatcher = properties.get("cq:lastReplicationAction_Publish", String.class);
}
if (isHidden ||
(StringUtils.isBlank(isPublished) && StringUtils.isBlank(isPublishedDispatcher)) ||
"Deactivate".equalsIgnoreCase(isPublished) ||
"Deactivate".equalsIgnoreCase(isPublishedDispatcher)) {
continue;
}
- Works on author
- Works on local AEM SDK publish
- On Publish through dispatcher (no way to bypass it on AEMaaCS): component renders empty. Properties confirmed present on Author. Still empty after a full pipeline deployment.
Questions:
- Does this hld the same way on AEMaaCS publish?
- What is the right way to check “is the page published” from a sling mode on Publish/Dispatcher?