Hi,
We have a component that needs to be removed but there are almost 100+ pages referencing the component, what is the best way to remove the component references from all those pages?
AEM 6.4.6.0
Thanks,
Prabu
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
From querydebug all the paths of pages containing component reference can be fetched, Below is the sample query-
path=/content
1_property=sling:resourceType
1_property.value=<path/of/the/component>
1_property.operation=like
Create a servlet/scheduler
-hit the path
-get the resource
-iterate over its nodes
-delete the component node
-save the session.
Views
Replies
Total Likes
From querydebug all the paths of pages containing component reference can be fetched, Below is the sample query-
path=/content
1_property=sling:resourceType
1_property.value=<path/of/the/component>
1_property.operation=like
Create a servlet/scheduler
-hit the path
-get the resource
-iterate over its nodes
-delete the component node
-save the session.
Views
Replies
Total Likes
Views
Replies
Total Likes
I would write a servlet , query the pages with component reference and remove the component via servlet. The steps would be pretty much same as what @gaurav3415 mentioned above.
Views
Replies
Total Likes
By creating a servlet using JCR_SQL2. The servlet will query all the pages for any pages that have the existing component's "sling:resourceType", and delete the node using the session object. Please vigorously test this in Dev, QA, Staging, before calling from Prod.
Views
Replies
Total Likes