Expand my Community achievements bar.

SOLVED

Replace tag in the reference pages

Avatar

Level 8

I have two tags 'wknd:old' and 'wknd:new'. 'wknd:old 'tag has 288 page references

And 288 pages have old tags as well few other tag values associated to them.

Suppose

/content/wknd/xyz is a page and it has tags=[wknd:industrial; wknd:compressors, wknd:old].

Here my point is to replace the old tag with the new tag on all pages without overriding existing tags just like below.

/content/wknd/xyz is a page and it has tags=[wknd:industrial; wknd:compressors, wknd:new]

Merging the old tag with a new tag isn't helping here, page reference still pointing to the old tag.

 

Can anyone provide the curl command to replace tag values on multiple pages.

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi, 

 

Here you can find a groovy script that does exactly what you need: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/replace-duplicated-tag-wit...

 

Regards,



Esteban Bustamante

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi, 

 

Here you can find a groovy script that does exactly what you need: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/replace-duplicated-tag-wit...

 

Regards,



Esteban Bustamante

Avatar

Community Advisor

@Vani1012 ,

 

You may write a simple servlet which does the following:

1) Run a query to get all the pages under the required path with wknd:old tag present

2) Update cq:tags property array by removing wknd:old tag and adding wknd:new tag. A simple array operation should do this task.

3) Save the updated cq:tags array back to the jcr:content node and save this resource.

 

You may choose to run this on Author and replicate to publish or run the same servlet on publish instances with proper login if available.

To add more security to this servlet, make sure this servlet logic runs only by a user who is in administrators group or by admin.

Archive this Servlet after the use, so that you may use it for similar use cases.

 

Hope this helps!