The macro sets parameters for the search term, result limit, and sorting order. It constructs a CQL query to find relevant content and executes it against the Confluence API. The results are displayed as a list.
#set($searchTerm = $parameters.searchTerm)
#set($limit = 50)
#set($sortOrder = "created desc")
## Define CQL query
#set($cqlQuery = "type in (page, blogpost, attachment) AND text ~ '\'$searchTerm\'' order by $sortOrder")
## Execute the query with expanded version data
#set($response = $ConfluenceManager.get("/wiki/rest/api/content/search?cql=$cqlQuery&limit=$limit&expand=space,version"))
<ul>
<p style="margin-bottom: 10px;">
Search results for <strong>$searchTerm:</strong>
</p>
#if($response.results.size() > 0)
#foreach($content in $response.results)
<li style="list-style-type: top; 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>
in $content.space.name space
</li>
#end
#else
<li>No results found for "$searchTerm"</li>
#end
</ul>Display Jira issue comments in a table
Display the number of users who have access to each space
Add a floating scroll-to-top arrow button in pages. Always visible, lightweight, and improves navigation for long documents.
Show H1 headings for child topics to enable easy navigation
Perform customized searches based on labels, content types, and other parameters
Display a "Delete me" message only for editors while editing a page
Generate a list of all content created by the current user by default, or by a specified user, across your Confluence site
Show specific content to users in a particular Confluence group
Get the latest cryptocurrency exchange rates for major coins
Hide specific content from users in a particular Confluence group