Content by User — Confluence Cloud Macro
The macro generates a list of content created by a specified user (or the current user by default) across your Confluence site. The macro uses CQL (Confluence Query Language) to query the content based on creator and content type, and displays the results in a styled list.
Template
#set($user = $parameters.user)
#set($contentTypeParam = $parameters.contentType)
#set($limit = 50) ## Limit the results to 50 items
## Prepare content types for CQL query, defaulting to "page, blogpost, attachment" if none are specified
#if($contentTypeParam)
#set($contentTypes = $contentTypeParam.split(","))
#else
#set($contentTypes = ["page", "blogpost", "attachment"])
#end
#set($contentTypeQuery = $StringUtils.join($contentTypes, "', '"))
## CQL query setup based on user parameter
#if($user)
#set($cqlQuery = "creator = '$user' AND type IN ('$contentTypeQuery') ORDER BY created DESC")
#else
#set($cqlQuery = "creator = currentUser() AND type IN ('$contentTypeQuery') ORDER BY created DESC")
#end
## Execute the CQL query, expanding space and version data
#set($response = $ConfluenceManager.get("/wiki/rest/api/content/search?cql=$cqlQuery&limit=$limit&expand=space,version"))
## Initialize userName to display in the header
#set($userName = "Current user")
#if($response.results.size() > 0)
#set($userName = $response.results[0].version.by.displayName)
#end
<ul>
<p style="margin-bottom: 10px;">
Content created by <strong>$userName</strong>:
</p>
#if($response.results.size() > 0)
#foreach($content in $response.results)
<li style="list-style-type: circle; margin-left: 30px;">
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-success">$content.type</span>
<a href="${response._links.base}$content._links.webui" target="_blank">$content.title</a>
<span style="color: grey;">(in $content.space.name space)</span>
</li>
#end
#else
<li>No content found for <strong>$userName</strong>.</li>
#end
</ul>User Parameters
User
Select a user to show their content
Content Type
Select content types
You May Also Like
Show confetti bursts and a motivational message upon saving an edited page
Perform customized searches based on labels, content types, and other parameters.
Basic greeting for user
Convert a specified amount of cryptocurrency to fiat currency.
The content of this macro will be printed and exported but not rendered on the page in view mode
Display the top comments from a selected Confluence page or the current page by default.
Display Confluence users filtered by their email addresses.
Add a configurable sticky banner to a Confluence page
Add a floating scroll-to-top arrow button in pages. Always visible, lightweight, and improves navigation for long documents.
Retrieve and display current exchange rates for major currencies against a specified base currency.