This script will add a new label to all of the child pages of the selected parent pageremove an old label from a page and replace it with a new one.
Code Block |
---|
language | java |
---|
linenumbers | true |
---|
|
//newstring labelsoldLabel to be added to pages
string [] newLabels = "confluence|power_scripts= "old_label";
string newLabel = "new_label";
//get theall idpages ofwith the old parentlabel
number [] parentpages = getPage("CTR", "Add a new label to the children of a page");selectPages("label = \"" + oldLabel + "\"");
//loop through each page
for(number page in pages) {
//get the pages idslabels
of the children numberstring [] childrenlbls = getChildPages(parent);
for(number child in children) { //loop through children
%page%.labels;
//remove the old label from the labels list
lbls = arrayDeleteElement(lbls, oldLabel);
//add new label to the list
lbls += newLabel;
//addset the labels tofor the child page
addLabelssetLabels(childpage, newLabelslbls);
} |
See Other Recipes
Filter by label (Content by label) |
---|
showLabels | false |
---|
showSpace | false |
---|
cql | label = "pages" |
---|
|
...