HI,
I have a situation where is there a CSS/JS which is causing multiple components in several pages visual disruption. We have a JS fix for that as interim solution which we can add in AEM Page property under "JS/CSS" section. That fixes the issue in the page.
We can not go for release now and that is why trying to fix using page prop as interim solution.
Question is: Is there anyway to propagate this JS fix from parent page's page prop to child pages..? Otherwise we have to manually add that piece of JS code in each of the pages which is almost like 300 pages..!!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Mayukh007,
You can run the groovy script to add the required page property in the 300 child pages.
Please find below the steps:
def path = "/content/whatever/parentpage";
getPage(path).recurse { page ->
def jcrContentNode = page.node;
jcrContentNode.setProperty("newProperty" , "value");
println("Property Added!!" + page.getPath())
}
save();
Try adding the fix at template level. This might solve the issue for most of the pages.
Make the necessary change(s) in the template(s) that are used to create those pages. That would fix the JS/CSS errors on all the pages that are created using that template.
I hope it helps !!
Hi @Mayukh007,
You can run the groovy script to add the required page property in the 300 child pages.
Please find below the steps:
def path = "/content/whatever/parentpage";
getPage(path).recurse { page ->
def jcrContentNode = page.node;
jcrContentNode.setProperty("newProperty" , "value");
println("Property Added!!" + page.getPath())
}
save();
You can have all your child pages inherit the page property from the parent page. From Sightly HTL, you can use the "inheritedPageProperties" helper.
<script data-sly-test="${inheritedPageProperties.jsConfigPath}" src="${inheritedPageProperties.jsConfigPath}"></script>
When you apply this script into the basepage.html, all children pages should be able to pick up the JavaScript config path as expected.
You can use context aware configuration to achieve propagation of parent property to children pages
Views
Likes
Replies
Views
Like
Replies