Stand with Ukraine 🇺🇦

Get Recent Updates — Confluence Cloud Macro

confluence-content

This Confluence user macro uses the Confluence Cloud REST API with CQL search to retrieve recently updated pages, blog posts, and attachments using user-defined limits, type inclusion, and prefix-based exclusion. It expands last-updated metadata, normalizes timestamps for display, and renders results as a square-bulleted list with type-based emoji, title links, and a muted author/date line.

The macro includes an early-return empty state and overflow-safe styling so the content always fits naturally within its container.

Try for free

Template

## Add styling
<style>
    .recent-list {
        list-style-type: square;
        padding-left: 20px;
        margin: 0;
        max-width: 100%;
        max-height: 100%;
        padding-bottom: 1rem;
    }

    .recent-list li {
        margin: 6px 0;
        max-width: 100%;
    }

    .recent-item {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .recent-title {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }

    .recent-title a {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .recent-emoji {
        font-size: 16px;
        flex-shrink: 0;
    }

    .recent-meta {
        font-size: 12px;
        color: #6b778c;
        margin-left: 22px;
        max-width: 100%;
    }

    .empty-state {
        margin: 0;
        padding: 12px;
        background-color: var(--ds-background-information, #e9f2fe);
    }

</style>

## Normalize date format
#set ($format = "yyyy-MM-dd'T'HH:mm:ss.SSSX")

## Read user params
#set ($limit = $parameters["limit"])
#if (!$limit)
#set ($limit = 20)
#end

#set ($includeBlog = $parameters["includeBlogpost"])
#set ($includeAttach = $parameters["includeAttachment"])
#set ($exclude = $parameters["exclude"])

## Build CQL query
#set ($types = [])
#set ($void = $types.add("page"))

#if ($includeBlog == true || $includeBlog == "true")
#set ($void = $types.add("blogpost"))
#end

#if ($includeAttach == true || $includeAttach == "true")
#set ($void = $types.add("attachment"))
#end

#set ($typeCql = $types.toString().replace("[","").replace("]",""))

#set ($cql = "type in (${typeCql})")

#if ($exclude && $exclude != "")
#set ($cql = "${cql} AND NOT title ~ '${exclude}*'")
#end

#set ($cql = "${cql} ORDER BY lastmodified DESC")

## Fetch content
#set ($url = "/wiki/rest/api/content/search?expand=history.lastUpdated,version&limit=${limit}&cql=${cql}")
#set ($result = $ConfluenceManager.get($url))

## Set empty state message
#if (!$result.results || $result.results.size() == 0)

<p class="empty-state">
    We looked everywhere, but it seems there are no issues for now 😔
</p>

#else

## Render results
<ul class="recent-list">

    #foreach ($item in $result.results)

    #set ($type = $item.type)
    #if ($type == "page")
    #set ($emoji = "📄")
    #elseif ($type == "blogpost")
    #set ($emoji = "📰")
    #elseif ($type == "attachment")
    #set ($emoji = "📎")
    #else
    #set ($emoji = "📁")
    #end

    ## Read meta data
    #set ($author = $item.history.lastUpdated.by.displayName)
    #set ($whenRaw = $item.history.lastUpdated.when)

    <li>
        <span class="recent-item">
            <span class="recent-title">
                <span class="recent-emoji">$emoji</span>
                <a href="$baseUrl$item._links.webui">$item.title</a>
            </span>

            <span class="recent-meta">
                Contributed by $author on $DateUtils.parseDate($whenRaw, $format)
            </span>
        </span>
    </li>

    #end

</ul>

#end

User Parameters

123

Limit

Set the maximum number of items to display

Include Blogpost

Check the box to include blogposts

Include Attachment

Check the box to include attachments

Exclude

Exclude content whose title starts with the value being entered