Expand my Community achievements bar.

SOLVED

Component that lists only published pages without using replication page properties or Component Disabler

Avatar

Level 2

I'm using AEM 6.5 and I'm working on a component that lists published child pages only.

 

At first I used the page properties cq:lastReplicationAction   and  cq:lastReplicationAction to make sure I get only the published pages as needed. The component worked as needed in author instance.

 

However, upon testing in publish instance, the component shows nothing. After some research, I discovered that the page properties I used are not carried over to publish by design. A workaround I found online was to manually disable the component com.day.cq.replication.impl.ReplicationPropertiesFilterFactory in author instance or to use the OSGi Component Disabler (OSGi Component Disabler (adobe-consulting-services.github.io) ).

 

I'm hesitating with this workaround because we have multiple sites on the same AEM instance and that means the ReplicationPropertiesFilterFactory component will be disabled for all sites and I don't know the risks.

 

After much thought and consideration, I decided to simply make the component list all child pages, without looking at their replication properties. Obviously, in author instance, the component lists all child pages (regardless if published or not), but in publish, it only lists the published pages, since, you know, we are in publish instance and it will not show us unpublished content. Hence, this simple solution will not work in author, but definitely works in publish, and that is what the end-user will see when they visit the public site.

 

I'm still hesitant with this new solution. It seems too simple/**bleep**? Am I missing something here? Are there any risks in this way-too-simple implementation?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

HI @marissi 
Go ahead with the alternative approach, looks good, just make sure you look for cq:Page type as child page.
Sometime, if you don't publish parent page but only the children pages, you can find the parent in a tree but that actual not a type of cq:Page



Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

HI @marissi 
Go ahead with the alternative approach, looks good, just make sure you look for cq:Page type as child page.
Sometime, if you don't publish parent page but only the children pages, you can find the parent in a tree but that actual not a type of cq:Page



Arun Patidar

Avatar

Employee

The simple version is definitely the way to go. If you need to have this feature working on both author and publish, you can enable the additional filter on author based on OSGI configuration and the "author" runmode.