Hi All,
We need to replace a specific text string, such as "Hello World," with "Greetings, Earthlings!" on approximately 2000 pages, text string is part of content fragment, What would be the best approach to accomplish this in AEM?
TIA..
Solved! Go to Solution.
Views
Replies
Total Likes
There are various ways to accomplish this. You can write a server or script to do this. You can also use groovy script as well as sling pipes. All the above will help you in automation
I suggest you write a custom servlet to find all content fragments under a specific path where it will find all instances of Hello World, replaces the word with Greetings, Earthlings!, and then it republishes all content fragments if they are already replicated; If content fragments are not yet activated, do nothing. Your servlet should also have a "mode=dry run" mode where it will just return you a list of all affected content fragments before the actually replace.
There are various ways to accomplish this. You can write a server or script to do this. You can also use groovy script as well as sling pipes. All the above will help you in automation
Is this not inefficient and a bit dangerous having everyone write a script / servlet that wants what is basic functionality?
I'd like to have search and replace across my library of content fragments but to write it myself seems a bit poor?
Views
Replies
Total Likes
Aem doesn’t provide you any ootb functionality that provides search and replace for the content. Atleast I am not aware of this. If you don’t want to write any type of automation then you can go with something called school way of creating a package of your content fragment and do a search and replace in the package directory after extraction using some ID and then making the package again and deploying it on aem. That’s the non-technical way I can think of without writing any automation (script/servlet)
Agreed @AEM_PARTY !
Content authoring Search and Replace just feels like something that should be available in a high-end, advanced tool like AEM without developers writing a script. A rudimentary version of it exists in the classic UI, but was never re-created in Standard (touch) UI.
Some use cases:
Maybe this is an opportunity for an AEM Commons tool?
It should:
Maybe someday!
Couldn't agree more and that is pretty much my use case. A product name changes and we have to manually go through hundreds of CFs updating them.
Views
Replies
Total Likes
Hi Team, please find below my blog post for Global find and replace text.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies