Replace tag in the reference pages | Community
Skip to main content
November 9, 2023
Solved

Replace tag in the reference pages

  • November 9, 2023
  • 2 replies
  • 738 views

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.

 

 

 

 

 

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 EstebanBustamante

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-with-original-tag-for-industrial-assembly/m-p/631348.

 

Regards,

2 replies

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
November 9, 2023
Esteban Bustamante
Sudheer_Sundalam
Community Advisor
Community Advisor
November 9, 2023

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