Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,797
Community Members
 
Community Events
184
Community Groups

How to get all the page details such as PageName,CreationDate and Last modified date using usermacro

Need to display the page details in table format using user macro in confluence

2 answers

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023 • edited

The general doc is here: https://community.atlassian.com/t5/Confluence-questions/How-to-get-all-the-page-details-such-as-PageName-CreationDate/qaq-p/2356767

Note that when you work with user macro context objects, those are instances of the corresponding internal Java classes. Therefore, if you want to work with page objects, 

Resources:

  1. Context objects in general: https://developer.atlassian.com/server/confluence/confluence-objects-accessible-from-velocity/
  2. Javadoc of the AbstractPage class: https://docs.atlassian.com/ConfluenceServer/javadoc/8.2.2/com/atlassian/confluence/pages/AbstractPage.html
  3. Because AbstractPage is inherited from ContentEntityObject, you should look for the base properties here: https://docs.atlassian.com/ConfluenceServer/javadoc/8.2.2/com/atlassian/confluence/core/ContentEntityObject.html

All in all, the page name and creation date can be accessed like this assuming that the object is "$page":

${page.displayTitle}
${page.creationDate}
...

 

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

Hi Alex, 

I tried the following macro but this macro is page specific. So, can you please help me for modifying this macro in such a way that I can get all the page details?

## @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>

 

Thanks,

Mrunal

Hi,

Can you please suggest the changes in the above macro for displaying all the pages details in confluence.

Thanks,

Mrunal

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events