We are trying to get json from components of specific pages to render on client. We can individually lookup each required page by its template type:
path=/content/mysite/en/
type=cq:page
1_property=jcr:content/cq:template
1_property.value=/conf/mysite/settings/wcm/templates/my-page-template
some othe properties to narrow down the required page.
Then we can do another query to retrieve all its children, and iterate through them looking for the 2 components we required, and then copying each property to a model for later conversion to json.
The problem is that the first query returns unpublished pages, which the user should not yet be able to see.
How do we only return published content?
The page only seems to have 3 properties:
1) jcr:created
2) jcr:createdBy
3) jcr:primaryType.
There is no property to give the published status?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @TB3dock
You are running this query on your author instance where you have both published and unpublished pages. But your query is going to run on publish at the end of the day and no unpublished pages will be available on publish instance. So user will not be able to see any unpublished pages as part of the search result.
You can still use the below 2 property to query but it becomes redundant on publish instance.
2_property=@jcr:content/cq:lastReplicationAction
2_property.value=Activate
Thanks!
Hi,
When a page is activated we will have below properties and can be added in query to retrieve only published pages
2_property=@jcr:content/cq:lastReplicationAction
2_property.value=Activate
For unpublished pages the cq:lastReplicationAction property wont be present in jcr:content node and for deactivated pages it will have value as Deactivate.
Hope this helps !
Hi @TB3dock
You are running this query on your author instance where you have both published and unpublished pages. But your query is going to run on publish at the end of the day and no unpublished pages will be available on publish instance. So user will not be able to see any unpublished pages as part of the search result.
You can still use the below 2 property to query but it becomes redundant on publish instance.
2_property=@jcr:content/cq:lastReplicationAction
2_property.value=Activate
Thanks!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies