Expand my Community achievements bar.

SOLVED

Creating Custom meta data that displays page status (Publish or Unpublish)

Avatar

Level 1

Hi there, we are using an external service for search and want to provide tons of meta-data info. One which includes the status of page content whether it is published or not. Since the service can't fetch the isActivated properties, we are creating a custom meta-data field that exposes the status of the page. Can this be done?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Manlosa,

When you think of the AEM content architecture, the public-facing AEM environment, which is the publish instances, would only store activated resources. Therefore if your external service is reading data from an AEM publish instances, they will never be able to see these unpublished resources. 

If however, your third party service is directly accessing your AEM author instance, then they will be able to retrieve every cq:Page node, and read the cq:lastReplicationAction attribute. Definetly I would review the external service API to understand what it is doing before thinking about using the AEM author as a data source, as in most cases are not best practice. 

And why are you allowing users to search your un-publish web pages? Unpublished pages are unpublished for a reason?

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

@Manlosa,

When you think of the AEM content architecture, the public-facing AEM environment, which is the publish instances, would only store activated resources. Therefore if your external service is reading data from an AEM publish instances, they will never be able to see these unpublished resources. 

If however, your third party service is directly accessing your AEM author instance, then they will be able to retrieve every cq:Page node, and read the cq:lastReplicationAction attribute. Definetly I would review the external service API to understand what it is doing before thinking about using the AEM author as a data source, as in most cases are not best practice. 

And why are you allowing users to search your un-publish web pages? Unpublished pages are unpublished for a reason?

Avatar

Level 1

@BrianKasingli,

     With this solution, our audience is the content authors so this is why the data source is author. The 3rd-party service can not retrieve the value for "cq:lastReplicationAction" but it can retrieve values from the custom meta-data schema that we created.

This is why I thought of extending the custom schema and add a field called "Is Published" and display the value of "cq:lastReplicationAction". Something like this. And if I can somehow get a value of "True/False", then I think the 3rd-party service might be able to fetch.

Not really sure if there are other ways around this.

 

Thanks!

Avatar

Community Advisor
hmm, how is the 3rd party api accessing the content from your author? when you use something like model.json or infinity.json, you can see all the properties for a given resource.

Avatar

Level 1

Hi Brian,

  Thanks for the input. Without going to details, this application is catered to content authors and they will need to see all contents in different states, including unpublished pages.

 

If you really think accessing the cq:Page will give access to attributes such as cq:lastReplicationAction, then maybe I need to review the 3rd-party service.

 

-Leo

Avatar

Community Advisor
Leo, there are a few properties that would or would NOT exist in a given cq:Page resource. for instance, if a page have never been replicated then cq:lastReplicationAction would not exist, therefore you can default the status to "not published". Assuming that you are providing a user-service user with the correct permissions, you will be able to see all the properties of a given resource using either the Sling API or Node API. Definitely have a look at how the data is received in the 3rd party API. Good luck.