Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Finding the unused components/templates from a legacy CQ project

Avatar

Level 2

Hi All,

is there an effective way to identify unused components/templates from a legacy CQ project.

Jon

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can write a query using sling:resourceType in the path '/content/<project> for the component / templates you are looking for. If it returns '0', then it will not be used

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

You can write a query using sling:resourceType in the path '/content/<project> for the component / templates you are looking for. If it returns '0', then it will not be used

Avatar

Level 10

As @bsloki mentioned write a simple query in your aem @ http://localhost:4502//libs/cq/search/content/querydebug.html

Here is one sample query:

path=/content/blog type=cq:PageContent property=cq:template property.value=/apps/blog/templates/homepage

If you need help, refer to query builder documentation @ https://docs.adobe.com/docs/en/cq/5-6-1/dam/customizing_and_extendingcq5dam/query_builder.html

Avatar

Level 2

bsloki wrote...

You can write a query using sling:resourceType in the path '/content/<project> for the component / templates you are looking for. If it returns '0', then it will not be used

 

Is there a way to list out all used/unused templates from the content folder? This would help us to search with templates names one by one.

Thanks in advance

Avatar

Level 10

There is nothing OOB, you will have to write your own custom query for this.

ex: See if you can use some joins or you can fetch all the templates and loop through the same query for each template