Is it possible for a page to automatically inherit its parent labels?
Asked by Deb:

Now that automation is available to use, is it possible to create a rule so that:

When a page is published it automatically inherits all the same labels from the parent page?

I've been looking through documentation but it still isn't super clear for me. TY!


Answers:
author: Sheerine Baucum
body: [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) [@Deb](/t5/user/viewprofilepage/user-id/5134428) This is a great use case for including smart values within labels. Our team is looking into this to see what options exist. I will follow up after our investigation. Thank you!

comments: author: Sheerine Baucum
body: [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) [@Deb](/t5/user/viewprofilepage/user-id/5134428) The smart value {{parent.page.labels}} is not a valid smart value, which is why it cannot be added to labels. However, you should be able to include valid smart values within the add labels component as long as the output returns valid characters.

Regarding functionality around inheriting parent page label - this cannot be accomplished right now, but we are aware of this concern and will look into prioritizing it based on our other requirements. Thank you for the feedback!


author: Derek Farr
body: Forgive me if I should create a new question for this, but I've run into issues trying to use (what I think are valid) smart values in labels. For example, {{page.author.fullName}}.

In my screenshot below, you can see that my rule failed with errors, even though the audit log shows the correct value is being retrieved for {{page.author.fullName}}. Am I doing something wrong? And are the smart values that are valid for labels documented somewhere?

![2023-02-06_19-28-27.png](https://community.atlassian.com/t5/image/serverpage/image-id/238517iBEF76FA93AE4D230/image-size/large?v=v2&px=999 "2023-02-06_19-28-27.png")


author: Darryl Lee
body: Ohey [@Derek Farr](/t5/user/viewprofilepage/user-id/5140258) -

Labels can't have spaces.

<https://jira.atlassian.com/browse/CONFCLOUD-37363>

I guess they need to update the error messages for Confluence:

<https://confluence.atlassian.com/automationkb/automation-for-jira-fails-to-copy-components-list-to-label-with-error-message-the-label-contains-spaces-which-is-invalid-1072473388.html>

Good suggestion there to add something like

    .replace(" ","-")

or maybe and underscore, if you prefer.


author: Derek Farr
body: Thanks for the extremely helpful response [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322)! I created a variable with the smart value {{content.author.fullName.replace(" ","_")}} and the rule worked.

Side note: To get the rule to work, I also had to change the colon (:) in my label to a hyphen (-). Seems like colons aren't allowed in labels either.


author: bob_dalm
body: Hi folks, this works;

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/324071i8E79E3CF45676BD2/image-size/large?v=v2&px=999 "image.png")

comments: author: Ilonna Pinion
body: HI [@bob_dalm](/t5/user/viewprofilepage/user-id/4087809)

Is this a solution for Confluence Cloud or a different Confluence instance?  

Thanks.


author: bob_dalm
body: Hi [@Ilonna Pinion](/t5/user/viewprofilepage/user-id/5136855)

Yea, Cloud :)


author: Adam Krusic
body: Can confirm this works in Confluence Automation. You need to add {{label}} in the Add label action, but when the automation runs, it does shows the parent labels.

![2024-06-06 12_25-screenshot_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/328521i72895ABAD63F17D8/image-size/large?v=v2&px=999 "2024-06-06 12_25-screenshot_2.png")

One other fun thing is if you want to inherit multiple parents (parent of a parent), you can update the smart value to include an extra ".parent" like {{content.parent.parent.labels.name}} and it will get labels from the parent's parent. Useful if you're implementing this and inherited labels don't already exist.

![2024-06-06 12_19-screenshot.png](https://community.atlassian.com/t5/image/serverpage/image-id/328517i980F68EDDF5B71AA/image-size/large?v=v2&px=999 "2024-06-06 12_19-screenshot.png")

We have up to 5 levels of parents in one space, so I have an automation that branches 5 times to capture each level. The cool thing is even if a 4th or 5th level parent doesn't exist, the automation still adds the 1st-3rd parent's labels succesfully to the child page It will technically error out on the audit log if a parent doesn't exist, so you may need to turn off the notifications if this is what you need.


author: Darryl Lee
body: Hi [@Deb](/t5/user/viewprofilepage/user-id/5134428) -

Ooooh, I finally get to answer a question about Automation for Confluence. Exciting!

(Upgrades personal Confluence Cloud instance to free trial of Premium...)

Ok, so... the bad news is, it doesn't seem like this is available.

There is an [**Add label**](https://support.atlassian.com/cloud-automation/docs/actions-in-confluence-automation/#Pages-and-blogs) action

There is a [**Smart Value**](https://support.atlassian.com/cloud-automation/docs/smart-values-in-confluence-automation/#hardBreak)for parent pages {{parent.page.labels}}

BUT THERE IS NO WAY TO use a **Smart Value** in the **Add labels** action. Boooooo.

Feature request for [@Sheerine Baucum](/t5/user/viewprofilepage/user-id/4751651) - I don't see this one filed yet. :-/

comments: author: Deb
body: Hi [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322)

TY for your answer!

Is this dependent on the type of the plan? Premium vs. Confluence Cloud?


author: Sheerine Baucum
body: [@Deb](/t5/user/viewprofilepage/user-id/5134428) Automation is currently only available in Confluence Cloud Premium.


author: emiliano.pedroza
body: [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) Any updates on this? Is there a workaround now?


author: Ilonna Pinion
body: Hi [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) \& [@Sheerine Baucum](/t5/user/viewprofilepage/user-id/4751651) ,

For better page analytics my org is restructuring our site and need to add labels to every page. I created a rule for new pages as a test but I can't get it to work even within my team space. \*sad face\*

If auto-labels aren't still part of Confluence Cloud; when will they be available and what's my workaround until then?

If it is available; why isn't my rule working? The parent page labels are simple and don't contain spaces. I'm also a member of the team under the user condition and created the test page within our team space, too. See images...

![Label rule.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/307614i79BDF37DAD2EBF98/image-size/large?v=v2&px=999 "Label rule.jpg")![label parents.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/307615i3145CD988CE7F701/image-size/large?v=v2&px=999 "label parents.jpg")![label fail.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/307616iC3F06CDEB7589768/image-size/large?v=v2&px=999 "label fail.jpg")


author: Darryl Lee
body: Hi [@Ilonna Pinion](/t5/user/viewprofilepage/user-id/5136855) !

Unfortunately [@Sheerine Baucum](/t5/user/viewprofilepage/user-id/4751651) (from Atlassian) informed me after my post that:
> smart value {{parent.page.labels}} is not a valid smart value, which is why it cannot be added to labels.

That's a bummer, since {{page.labels}} **is** valid, as are these parent values:

* {{page.parent.url}}

* {{page.parent.id}}

* {{page.parent.title}}

And the docs suggest:
> When you're trying to understand what a particular smart value might do, it can help to read them in reverse. For example:
>
> {{page.title}} is "the title of the page" (that's relevant to your rule component).
>
> {{page.parent.title}} is "the title of the *parent* (of the relevant) page".

I mean, it sure seems like {{page.parent.labels}} should work. Any movement on this, [@Sheerine Baucum](/t5/user/viewprofilepage/user-id/4751651) ? It's been a year. :-}


author: Darryl Lee
body: Oh bummer, [@Sheerine Baucum](/t5/user/viewprofilepage/user-id/4751651) no longer works at Atlassian. Hum. I'm going to tag in [@Daniel Eads](/t5/user/viewprofilepage/user-id/1527694) to ask if he might know the answer to whether {{page.parent.labels}} will be a valid Smart Value.


Tags: label