AEM - Possible to Add Meta Tags to Pages in Bulk | Community
Skip to main content
Level 3
March 31, 2022
Solved

AEM - Possible to Add Meta Tags to Pages in Bulk

  • March 31, 2022
  • 3 replies
  • 3083 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Varun_Shakya
Community Advisor
Community Advisor
March 31, 2022

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();
KMarchewaAuthor
Level 3
March 31, 2022

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!

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
March 31, 2022
Anmol_Bhardwaj
Community Advisor
Community Advisor
March 31, 2022

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