How to find the list of pages which does not have any content in it. | Community
Skip to main content
Level 3
January 17, 2024
Solved

How to find the list of pages which does not have any content in it.

  • January 17, 2024
  • 3 replies
  • 1959 views

How can we find empty page list using query builder in AEM.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kamal_Kishor

@vijitha : thanks for providing further details.
I do not think you can get the list of all such pages using querybuilder debugger alone.

You will have to use query + additional filtering on the results using java/groovy etc. You will be able to do this on local instance and will have to get content packages from your working instance. 
Create a servlet so that you have a trigger point/url to run this.

  • Run a query to find all the nodes of resource type wcm/foundation/..../responsivegrid
    Ensure to run your query under a specific path to ensure query performance.
  • From the result set, iterate through the results page, whatever pages do not have any children under this node, you can consider them to be empty pages.
  • Resolve the path of Page from the node 
  • In the end you should get the list of all such pages.

You can refer this for Querybuilder Java API - https://medium.com/@manumathew28.94/query-builder-aem-5869a1850c85

 

thanks.

3 replies

Kamal_Kishor
Community Advisor
Community Advisor
January 17, 2024

@vijitha : It is difficult to classify a empty page as Pages are basically nodes and properties. Every page that gets created has some nodes and properties such as pagename/jcr:content, jcr:title, cq:template etc.

I assume that you want to find pages which does not have any component dropped on it which again is very tricky as you may have your templates with initial content which will create pages with that initial content so you will always end up having some nodes in the page on creation itself.

If you have an identifier for an empty page which gets stored at jcr:content node of the page for eg, then you can do a  query for that property and get the list of such pages.

Please refer this querybuilder cheatsheet to see what you can use to build your queries: https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md

 

vijithaAuthor
Level 3
January 17, 2024

Hi @kamal_kishor 

Thanks for your reply. your assumption is  correct.I don't see any specific identifer to write queryto get empty page list . As you said while creating page with template will be having some nodes so I have deleted those nodes and it looks like below.

  •  
Kamal_Kishor
Community Advisor
Kamal_KishorCommunity AdvisorAccepted solution
Community Advisor
January 17, 2024

@vijitha : thanks for providing further details.
I do not think you can get the list of all such pages using querybuilder debugger alone.

You will have to use query + additional filtering on the results using java/groovy etc. You will be able to do this on local instance and will have to get content packages from your working instance. 
Create a servlet so that you have a trigger point/url to run this.

  • Run a query to find all the nodes of resource type wcm/foundation/..../responsivegrid
    Ensure to run your query under a specific path to ensure query performance.
  • From the result set, iterate through the results page, whatever pages do not have any children under this node, you can consider them to be empty pages.
  • Resolve the path of Page from the node 
  • In the end you should get the list of all such pages.

You can refer this for Querybuilder Java API - https://medium.com/@manumathew28.94/query-builder-aem-5869a1850c85

 

thanks.

TarunKumar
Community Advisor
Community Advisor
January 17, 2024

Hi @vijitha ,

By empty page I'm assuming you are trying to find pages which doesn't have jcr:content node. That means it will not have "jcr:primaryType" for "jcr:content" node.
Please try to use below query in your query builder, it should give you the results.

type=cq:Page path=/content/<sample-page-path> property=jcr:content/jcr:primaryType property.operation=not


Thanks
Tarun

vijithaAuthor
Level 3
January 17, 2024

Hi @tarunkumar 

Thanks for your reply.I have jcr:content node for page and inside jcr:content I see two responsive grid nodes and under one responsive grid I see page title component. Do we have any way to check if the page is having only page title component.I have written below query to get page list but it's giving all the pages where we have page title component but I need the list where we have empty page or if it has only the page title component.

path=/content/****
property=jcr:content/cq:template
property.value=/conf/****/settings/wcm/templates/***
property.operation=like
property.1_property=apps/****/components/content/page-title
property.1_property.operation=exists

 

 

TarunKumar
Community Advisor
Community Advisor
January 18, 2024

Hi @vijitha ,

If you need pages which contain specific component like "page title component " in your case, please try to use sling:resourceType in your query builder for property and for value use its corresponding value.
something like below:-

path=/content/<sapmle-page-path> 1_property=sling:resourceType 1_property.value=<resource-type>/<value>/<your-page-title-component>

 

Thanks
tarun

kautuk_sahni
Community Manager
Community Manager
January 18, 2024

@vijitha Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni