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.

Could you expand on this?

I've tried the 2nd option you suggest. Using the "Create from Template" macro to call my own template that has variables you select for the page title. But when it builds the page the title isn't filled out.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

159 views 3 5
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