Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can page title be used as a variable in a page template

Andreas Dalman (UTS)
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2021

I am trying to create a template where the title of the page (which the user will need to define when using the template, so not pre-existing) can be used in other parts of the new page as a variable.

For example, the page variable used as a heading for a TOC Macro which will reside at the bottom of the page - useful for reminding users of the topic on long pages where the title is no longer visible when you get to the end. Currently I have a cumbersome instruction to insert the page title above the TOC Macro in the footer - this obviously is not dynamic so if the page title is renamed a mismatch will occur if editing the TOC heading is not done as well.

Ideally I would like to be able to do this without coding, but of course also have interest in any such solutions too.

1 answer

0 votes
Dominic Lagger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2021

Hi @Andreas Dalman (UTS) 

This is only possible with coding :) I think you can use a user macro.

The user macro is really simple

## @@noparam
$content.getTitle()

And then in the template use this user macro. 

Regards, Dominic

Andreas Dalman (UTS)
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 15, 2021

Thanks Dominic for your answer,

Some code is fine as long as it does not have to be done in the back end.

I do need a little clarification.

What is a 'user macro' - in Macros I search user but there is not one simply named 'User' that I can choose available to me (seclections include Content by User, Profile Picture, User List and User Profile).

Am I mistunderstanding (I tried putting the code inside a HTML macro but is simply prints) - websearch suggests getTitle() is javascript but I cannot find a macro for that...

Confluence docs on User Macro seem to point to admin level config, but our instance does not have this option (maybe disabled/hidden or not available in the version we are running 6.15.9)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events