I am using AEM 6.5.9. I have a requirement to redesign 2000 pages of the website which are using the same template.
As part of website redesign I need to
1) add a property to the JCR for say 600 pages of the 2000
2) add a component to 2000 pages and display the output for the page
Please let me know the best approach for this using AEM programming. Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
Create an on deploy script and use ACS On-Deploy pattern On-Deploy Scripts (adobe-consulting-services.github.io)
I've put sample code and examples here How to add property and author a component programmatically? - AEM.Design
Create an on deploy script and use ACS On-Deploy pattern On-Deploy Scripts (adobe-consulting-services.github.io)
I've put sample code and examples here How to add property and author a component programmatically? - AEM.Design
Thanks for the reply @maxbarrass-anchora.
This approach looks good to add/modify properties. How do I author a component in 2000 pages, please suggest.
Thanks.
Hi @Lalitha_j
There are many ways of doing this, if acs-tools package is installed in your AEM instance then this can be achieved through AEM Fiddle console. And adding a new component to the page can be achieved through ResourceResolver API. Write the business logic in Fiddle console and run your code.
You can write a function that accepts a resource and makes necessary structure under it. Do you want an example?
Side note. Also as this is On-Deploy code you can find examples of unit tests in the ACS repo. Other methods you will be shooting blind.
This can be done through Groovy Script
- Installation:
https://github.com/icfnext/aem-groovy-console
- Help Docs:
https://hashimkhan.in/aem-adobecq5-code-templates/groovy-script/
https://labs.tadigital.com/index.php/2018/12/18/groovy-script-in-aem/
It is similar to Java, and you can write a script and run through your groovy console on every environment.
@Lalitha_j Please try achieving your use-case using the Groovy script.
Download the groovy console package from https://github.com/OlsonDigital/aem-groovy-console
Reference: https://labs.tadigital.com/index.php/2018/12/18/groovy-script-in-aem/
Views
Likes
Replies
Views
Likes
Replies