Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

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

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Level 8

@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.

View solution in original post

7 Replies

Avatar

Level 8

@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

 

Avatar

Level 4

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.

kushi_0-1705480145712.png

  •  

Avatar

Correct answer by
Level 8

@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.

Avatar

Community Advisor

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

Avatar

Level 4

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

kushi_0-1705481228798.png

 

 

Avatar

Community Advisor

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

Avatar

Administrator

@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