Aggregated pages attributes — Confluence Cloud Macro
This Confluence user macro fetches and displays a table of page attributes based on a CQL query, including page title, author, last updated date, and status. It uses REST API calls to retrieve metadata and applies color-coded status indicators for better visibility.
User Parameters
Search Query
CQL query, for instance: space = IDEAS or label = idea
Template
#set( $url = "/wiki/rest/api/content/search?cql=type=page and $parameters.query&limit=100&expand=version,history,space")
#set( $pages = $ConfluenceManager.get($url).results )
## Color mapping between statuses and Storage format
#set( $colors = {
"#ffc400": "Yellow",
"#2684ff": "Blue",
"#57d9a3": "Green",
"#8777d9": "Purple",
"#ff7452": "Red"} )
<table>
<thead>
<tr>
<th>Page</th>
<th>Author</th>
<th>Updated</th>
<th>Status</th>
</tr>
</thead>
<tbody
#foreach ( $p in $pages )
## Get status of the page. Name and color
#set($state = $ConfluenceManager.get("/wiki/rest/api/content/$p.id/state").contentState)
#if($state)
#if($state.name == "Verified")
#set($sName = "✅ Verified")
#set($sColor = "")
#else
#set($sName = $state.name)
#set($sColor = $colors.get($state.color))
#end
#end
<tr>
## page
<td>
<ac:link>
<ri:page ri:space-key="${p.space.key}" ri:content-title="${p.title}"/>
<.ac:link>
</td>
## author
<td>
<ac:link>
<ri:user ri:userkey="${p.history.createdBy.accountId}"/>
</ac:link>
</td>
## updated date
<td>$p.version.friendlyWhen</td>
## status
<td>
#if($state)
<ac:structured-macro ac:name="status">
<ac:parameter ac:name="title">$sName</ac:parameter>
<ac:parameter ac:name="colour">$sColor</ac:parameter>
</ac:structured-macro>
#end
</td>
</tr>
#end
</tbody>
</table>Recommended Macros
Show filtered issues and their relations
Space Information macro by space Id
Create dropdown menus in Confluence Cloud with custom sets of options, multiselect features, and permission gates
Fetch a random quote from the DummyJSON API and display it in a stylized blockquote format.
Shows worklogs from the Jira issue
Create dropdown menus in Confluence Cloud with predefined sets of options and permission gates
Shows H1 headings directly to children's topics for easy navigation.
Use sticky previous/next buttons to navigate through your Confluence page tree in a linear reading order