This macro, "List of pages in space", retrieves and displays all pages within a given Confluence space in a sortable and filterable table. It uses the Confluence REST API to fetch the spaceId based on a provided space key, then queries all pages under that space. Each page is displayed with its title (linked to the page), last updated date, author (with profile link), and labels (linked to Confluence search by label). The table is styled using Atlassian AUI classes for a clean and consistent Confluence appearance. A filter input box above the table allows users to dynamically search pages by title, author, or labels, hiding rows that donโt match the search query. The filter logic is implemented in vanilla JavaScript for lightweight performance. Author information is conditionally styled: if the current user is the page creator, their name is highlighted with an in-progress lozenge, otherwise a subtle lozenge is used. Labels are fetched via an additional API call per page and displayed as clickable lozenges linking to label-based search. This macro improves space navigation by giving users a quick overview of all content, allowing efficient filtering without leaving the page. It is ideal for project documentation spaces, knowledge bases, and team wikis where content grows rapidly and structured discovery is essential
#set ($spaceId = $ConfluenceManager.get("/wiki/api/v2/spaces?keys=$parameters['key']").results[0].id)
#set ( $pagesInSpace = $ConfluenceManager.get("/wiki/api/v2/spaces/$spaceId/pages") )
#set ($format = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
<input type="text" id="filterInput" placeholder="Filter by title or label..."
style="margin-bottom: 10px; padding: 5px; width: 200px; border: 2px solid var(--ds-border-input, #8C8F97); border-radius: 4px;">
<table class="aui aui-table-sortable" id="pagesTable" border="1" cellspacing="0" cellpadding="5" style="border: none;">
<thead>
<tr>
<th>Name</th>
<th>Last Updated Date</th>
<th>Created By</th>
<th>Labels</th>
</tr>
</thead>
<tbody>
#foreach ($pageInSpace in $pagesInSpace.results)
#set ($pageLink = $pageInSpace._links.webui)
<tr>
<td><a href="$pageLink" target="_blank">$pageInSpace.title</a></td>
<td>$DateUtils.parseDate($pageInSpace.createdAt, $format)</td>
#set ($isCurrentUser = $StringUtils.equals($user.accountId, $pageInSpace.authorId))
#if ($isCurrentUser)
#set ($blueStyle = "aui-lozenge-inprogress")
#set ($author = $user)
#else
#set ($blueStyle = "aui-lozenge-subtle")
#set ($author = $ConfluenceManager.get("/wiki/rest/api/user?accountId=$pageInSpace.authorId"))
#end
<td>
<a href="${baseUrl}/people/${author.accountId}">
<span class="aui-lozenge $blueStyle">
@$author.displayName
</span>
</a>
</td>
#set ($pageLabels = $ConfluenceManager.get("/wiki/api/v2/pages/$pageInSpace.id/labels").results)
<td>
#foreach ($label in $pageLabels)
##https://wombats.atlassian.net/wiki/search?product=confluence&labels=second_round
<a href = "${baseUrl}/search?product=confluence&labels=${label.name}">
<span class="aui-lozenge aui-lozenge-subtle">$label.name</span>
</a>
#end
</td>
</tr>
#end
</tbody>
</table>
<script>
document.getElementById("filterInput").addEventListener("keyup", function() {
let filter = this.value.toLowerCase().trim();
let rows = document.querySelectorAll("#pagesTable tbody tr");
rows.forEach(row => {
// Grab all cells
let cells = row.querySelectorAll("td");
// Take only: 0 (Name), 2 (Created By), 3 (Labels)
let rowText = (
cells[0].textContent + " " +
cells[2].textContent + " " +
cells[3].textContent
).toLowerCase();
// Show/hide depending on match
row.style.display = rowText.includes(filter) ? "" : "none";
});
});
</script>Display a list of guest users in a specific Confluence space
Display space details such as type, status, creation date, and links to permissions and calendars
List all Confluence spaces with details such as space name, author, and creation date
Display an overview of all pages in a space, including title, version, and last updated date
Find images within page attachments. Handy for reusing files and updating them all at once.
Display a custom list of recently updated content
Generate an alphabetical list of labels from all spaces, linking each label to its corresponding content pages
Display a table showing the assignee history for issues based on JQL. The table includes the following information: Issue Key, Summary, and Assignee History.
Retrieve and display labels from a specified space
Add a configurable floating panel to a Confluence page