User Macro to display the Page Information in Confluence
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This KB is to help you write a User Macro to display the Page Information (Page Name, Last modified by, Last modified Date, Creator) on Confluence Pages.
Solution
Be mindful that customisations are not part of our support scope as per Atlassian Support Offerings. Any effort provided to support issues related to customization will be on a best-effort basis by the support engineer.
The following User Macro could help:
Go to icon > General Configuration > User Macros
Choose Create a User Macro
Enter the macro details template
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
## @param Page:title=Page|type=confluence-content|required=true|desc=Choose Page to get the Information for #set ( $colonIndex = $paramPage.indexOf(":") ) #if ( $colonIndex == -1 ) #set ( $spaceKey = $space.key ) #set ( $pageName = $paramPage ) #else #set ( $spaceKey = $paramPage.substring(0, $colonIndex) ) #set ( $pageNameIndex = $colonIndex + 1 ) #set ( $pageName = $paramPage.substring($pageNameIndex) ) #end #set ( $requestedPage = $pageManager.getPage($spaceKey, $pageName) ) <table> <tr> <td>Page Name</td> <td>Page Creator Name </td> <td>Last Modified Date</td> <td>Last Modifier </td> </tr> <tr> <td>$requestedPage.getTitle() <td>$requestedPage.getCreatorName()</td> <td>$action.dateFormatter.formatDateTime($requestedPage.lastModificationDate)</td> <td>$requestedPage.getLastModifierName()</td> </tr> </table>
Click Add
Use the user macro in the page
To know more about User Macros, please refer to Writing User Macros.
Was this helpful?