Variables in a Confluence page name

I have a page named "1.0" that uses the Expand and Include Page macros to show a child page named "A Child 1.0"while staying in the parent page. Works nicely. But now I copy the parent page to a new page named "1.1" and the child page to "A Child 1.1". I have to edit the new parent page so it doesn't include the old "A Child 1.0" page. This is quite a bit of work when there are many children. I don't want to use a new space for each version.

So the question is whether there's any way to use a variable in the name of the page to be included? I want to say "Expand: Include Page: A Child %myvar%" and then define %myvar% somewhere on the parent page.

I've poked around the open issues for this at JAC, didn't see any progress on them there.

~Matt

3 answers

You could use the Run-now macro and the $page_title pre-defined variable to construct the child title. That will work for simple concatenation for child names. Otherwise, you would need a script or something else. The reporting plugin might have something similar as well.

Hi Matt,

As Bob suggests, the Reporting plugin (by your own company) will be able to pick out a variable created on the parent page, in the form of a scaffold field. You can then inject this into the include macro. Alternatively you could take the name of the current page and inject that. The mark up will be something similar to this (untested):

{report-on:injected=true}
{include:A child %page:title%}
{report-on}

Hope that helps,

Charles

I think the easiest thing to do is create a user macro with the other macros inside. That way you can set a parameter in the macro browser and that parameter can set the variables.

Or you can add variables to templates. If you create a page from a template you can add your values to the variables before the page is initially built.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

251 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you