Have you ever noticed that while authoring an AEM component, the component dialog box does not provide any hints or alerts for if the selected content path is published or not? This is a confusing scenario for AEM authors, especially when setting or choosing the content path in the component dialog for pathfield and xffield resourceTypes.
I recently encountered the same scenario with one of our clients. They set the unpublished path for a link in the component dialog and published that page. After publishing the page, they found that the component used on the page showed a broken link on the AEM publish instance.
Unfortunately, AEM does not have the functionality to show unpublished notifications for selected content paths while authoring the components. That goes for whether you select page path, experience fragment path, asset path, or content fragment path.
To overcome this scenario, we can extend the functionality of the pathfield and xffield resourceType.
Steps to extend the functionality of pathfield and xffield resourceType
1. First, open CRXDE Lite console ie.http://localhost:4502/crx/de/index.jsp
2. Go to /app/
3. Create one node named clientlibs with the following properties. After that, you create one folder named js inside clientlibs node and also one file named js.txt.