Page Fixed Version — Confluence Cloud Macro
This Confluence user macro displays a page’s fixed version by scanning for labels starting with fixed-version_. It uses the Confluence Cloud REST API to check the labels of the current page and its parent pages (up to the space homepage), allowing version values to be set once and reused across related documents. This makes it easy to keep release information consistent across multiple pages.
Template
#set($fixVersion = "")
#set($pageIdToCheck = $page.id)
#foreach ($i in [1..50]) ## Set a safety limit to prevent infinite loops
#if ($pageIdToCheck)
#set($labelResponse = $ConfluenceManager.get("/wiki/api/v2/pages/$pageIdToCheck/labels"))
#if ($labelResponse && $labelResponse.results)
#foreach ($label in $labelResponse.results)
## Look for label starting with e.g. "fixed-version_450"
#if ($label.prefix == "global" && $label.name.startsWith("fixed-version_"))
## $fixVersion = 450
#set($fixVersion = $label.name.substring(14))
#break
#end
#end
#end
#if ($fixVersion != "")
#break
#end
#if ($pageIdToCheck == $space.homepageId)
#stop
#end
#set($pageInfo = $ConfluenceManager.get("/wiki/api/v2/pages/$pageIdToCheck"))
#if ($pageInfo && $pageInfo.parentId)
#set($pageIdToCheck = $pageInfo.parentId)
#else
#break
#end
#end
#end
#if ($fixVersion != "")
$fixVersion
#else
<span style="color: #888;">
No fixed version found. Label this page or one of its parents with
<code>fixed-version_x.y.z</code>.
</span>
#end
You May Also Like
Space Information macro by space Id
Display page edit and view restrictions in Confluence to get essential permission details, including users, groups, and inherited access.
An overview of all pages within one space which contains the title, the version, and the last updated date
This macro allows user to retrieve all pages from current space despite limitation of 250 pages per request
Show an expandable page tree for a selected parent page (defaults to the current page)
Find image within page attachments. Handy for reuse files and update them all at once
User macro for displaying issues using custom JQL filter
Shows page creation date
Display a list of Confluence pages with CSV download feature
Macro for printing all the spaces