Displaying the page version

Page layout.pngI would like to display a string somewhere on a Confluence page (top or bottom) which contains the version number.

E.g. 'Page Version 3.1'

Following the advice here, I have modified the layout (Confluence Admin > Layouts) by adding the following line to the page layout decorator content.

$confPage.version

However, this only displays the number. I would also like to display the text.

It also overwrites part of the text indicating who last modified the page. See screenshot. How can I avoid this?

2 answers

1 accepted

Find the following code part (http://confuenceserver/confluence/admin/editdecorator.action?decoratorName=decorators/page.vmd)

<div id="main-content" class="wiki-content">
           $body
 /div>

and change it to 

<div id="main-content" class="wiki-content">
  #set ($confPage = $helper.page)
  Page version: <strong>${confPage.version} ${confPage.versionComment}</strong>
           $body
 /div>

This will display the version number and a comment, if this is your intention

You need to use the default theme, not documentation theme

And as I have mentioned earlier you can reference other page properties as described in API doc

You can reference other properties from Page object

See here: https://docs.atlassian.com/confluence/latest/com/atlassian/confluence/pages/AbstractPage.html

Basically all the getters are quite safe to use.

For version comment: https://docs.atlassian.com/confluence/latest/com/atlassian/confluence/core/ContentEntityObject.html#getVersionComment()

so, in your case:

$confPage.versionComment

As for text placement, I cannot help here without seeing your layout

Thanks for the reply Sash. I'm using the default layout - all I've done is add $confPage.version after the line #set ($confPage = $helper.page).

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 Apr 13, 2018 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...

2,896 views 27 12
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