Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM - Possible to Add Meta Tags to Pages in Bulk

Avatar

Level 3

Hello,

 

We have a need to add meta tags in bulk to many of our pages in AEM (normally adding through Page Properties -> Meta Tag). I was wondering if there is a way to automate this/do it in bulk, either through cURL or other means?

Thanks,

Kelly

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
1 Reply

Avatar

Community Advisor

check  this groovy script point #2

 ref:- https://labs.tadigital.com/index.php/2018/12/18/groovy-script-in-aem/

 

 
 
 
 
 
Java
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def path = "/content/we-retail/us/en/user/account/order-history";
def propName = "testPropName";
def propValue = "testPropValue";
 
getPage(path).recurse { page \->
    def jcrContentNode = page.node;
    if (jcrContentNode.hasProperty(propName)) {
        def oldPropValue = jcrContentNode.getProperty(propName).getString();
        if(!oldPropValue.equals(propValue)) {
            jcrContentNode.setProperty(propName, propValue);
        }
    } else {
        jcrContentNode.setProperty(propName, propValue);
    }
}
 
save();

Avatar

Level 3

Thanks much for the quick response. Unfortunately, I cannot install the Groovy Console package in AEM. Is there a good alternative that does not require in new packages in AEM itself?

Thanks!

Avatar

Correct answer by
Community Advisor

Hi @KMarchewa, here are few options, I hope you will find something that will suits you.

  1. Groovy script run from Groovy console - this option has been already described by @Varun_Shakya
  2. If you have ACS Commons you can try to use Manage Controlled Processes, please find all the details under:
    1. https://kiransg.com/2021/12/10/bulk-add-update-and-delete-properties-in-aem-without-using-groovy-con...
    2. https://adobe-consulting-services.github.io/acs-aem-commons/features/mcp/index.html
  3. You can use cURL, here are 2 articles that describe how to do it:
    1. https://sourcedcode.com/blog/aem/update-a-node-jcr-property-in-aem-with-curl
    2. https://sourcedcode.com/blog/aem/update-multi-value-node-jcr-properties-in-aem-with-curl
  4. Last option, you can use OOTB AEM Bulk Editing of page properties:
    1. https://experienceleague.adobe.com/docs/experience-manager-65/authoring/authoring/editing-page-prope...
    2. https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/bulk-editing....

Avatar

Community Advisor

You can write the same code @Varun_Shakya mentioned in a servlet and push it through the code.