In this page

This page is applicable to legacy Better Content Archiving versions only. For the documentation on modern versions, see this page.

Velocity objects available for the notification emails in Better Content Archiving pre-6.0.0 versions

Domain Object Description
$user User instance representing the user this email will be sent to.
(This also means that the template will be rendered separately for each addressee.)
$subject Subject of the notification email.
You can use the ${pages.size()} expression to refer to the length of the $pages collection.
$reason Identifies the reason why a notification is sent (can also be interpreted as the "role" of the addressee).
Possible values:
$pages Collection of Page instances that triggered the notification email.
$pagesArchived For "archived pages" emails only.
Map of Page instances and their corresponding archiving descriptor.
#set($pa = $pagesArchived.get($page))

$pa.freshPage ## the original page
$pa.archivingAction  ## describes why and how this page was archived or skipped (string)
$pa.archiverName  ## name of the user who marked the page for archiving or null if this is automatically archived
$pa.reason  ## reason of archiving or null
$pa.skipped  ## whether it is skipped (true) or actually archived (false)
$pageLastUpdates For "expired pages" emails only.
Map of Page instances and their corresponding update descriptor.
#set($plu = $pageLastUpdates.get($page))

$plu.explicitlyExpired ## whether this pages expired on an explicit date (true) or by some other reason, typically not being updated (false)
$plu.updateAction ## describes the last update (page edited, attachment added, etc.) (string)
$plu.updaterName ## name of the user who made the last update
$plu.updateDate ## when was the last update
$pagesNotViewedRecently For expired pages emails only.
Map of Page instances and their corresponding view descriptor.
#set($pnv = $pagesNotViewedRecently.get($page))

$pnv.pageId ## ID of the page
$pnv.viewerName ## name of the user who viewed the page most recently
$pnv.viewDate ## when was the last view
$contentQualityStatsTool Velocity tool to work with content quality statistics.
$contentQualityStatsTool.timestamp ## timestamp when the oldest space statistics was computed
$contentQualityStatsTool.hasValidStats() ## true if at least one space's statistics are available
$contentQualityStatsTool.hasValidCompleteStats() ## true if all space's statistics are available
$contentQualityStatsTool.hasValidSpaceStats(space) ## true if a space has valid statistics

## global quality metrics:
$contentQualityStatsTool.combinedPageCountTotal ## equals to pageCountTotal + archivedPageCountTotal

## space quality metrics:
$contentQualityStatsTool.getCombinedPageCountBySpace($space) ## equals to getPageCountBySpace($space) + getArchivedPageCountBySpace($space)
$pageStatsTool Velocity tool to work with page statistics.
## self-explanatory page statistics:
$pageStatsTool.getPageCountBySpace(pages, spaceKey)
$pageStatsTool.getMostRecentlyViewedPageAgeInDaysBySpace($pages, $pageLastViews, $spaceKey)
$pageStatsTool.getYoungestPageAgeInDaysBySpace($pages, $pageLastUpdates, $spaceKey)
$pageStatsTool.getOldestPageExpiredInDaysBySpace($pages, $pageLastUpdates, $spaceKey)

## the one below is not trivial :-)
## returns the number of days until the oldest page gets archived,
## or -1 if archiving is not enabled in that space,
## or -2 if there are only explicitly expired pages in the space (so there is nothing to auto-archive):
$pageStatsTool.getOldestPageAutoArchivingInDaysBySpace($pages, $pageLastUpdates, $spaceKey)

$pageStatsTool.getOldestPageUpdateBySpace($pages, $pageLastUpdates, $spaceKey)
$pageStatsTool.getOldestNonExplicitlyExpiredPageUpdateBySpace($pages, $pageLastUpdates, $spaceKey)

Editing notification email templates in Better Content Archiving pre-4.5.0 versions

Although the web-based editor is not available in these older app versions, it is still doable with some really minor technical experience. The "skills" required are being able to expand and create ZIP files and to use a plain text editor. Please follow the guide below.


  1. Download the exact version of the app JAR file you are already using from Atlassian Marketplace, and copy that to some directory where you will do the work.
  2. Create a subdirectory called expanded in the working directory, and enter that.
  3. Decompress the app file to expanded. Although it has the file extension JAR, it is a regular ZIP file, thus any ZIP client will be able to decompress it for you.
    If you use a commandline ZIP client, simply run this while you are in expanded:
    unzip ../better-content-archiving-for-confluence-4.1.0.jar
  4. Enter the templates/email/html directory, which was created in expanded. It contains all templates from which the emails are generated: one .vm file per email type, named accordingly.
  5. If you want to change the email that is sent when expired pages are found, for example, open the file expiring-pages-notification.vm file in your favourite plain text editor.
  6. The file itself is a regular HTML file, containing additional #if(), #foreach() statements written in Velocity language. You can freely edit the HTML parts, and also modify Velocity if you understand what you are doing.
  7. When you are done with your changes, save them and rebuild the JAR file by creating a ZIP file with a different name. Start the archive in the folder expanded and create the JAR in the parent directory, to ensure that the directory and file structure is identical with the original!
    For example, run this in expanded:
    zip -r ../better-content-archiving-for-confluence-4.1.0-custom.jar .
  8. Now install the new app file to your Confluence by uploading that with the Universal Plugin Manager and test it. If there are further changes to make, go to step 5 and continue making modifications.

That's all!

Some further tips:

  • Most graphical ZIP clients support directly editing files in ZIP (JAR) archives. That means, you can launch the text editor from the ZIP tool, and when you close the editor, the ZIP tool will ask you whether to rebuild the archive? You can use this super fast method to simplify the process of making changes.
  • When you want to use international characters in the template, make sure you save your file with UTF encoding. Or, to be even more bulletproof, use HTML character codes. (Remember: templates are ultimately HTML files.)


Ask us any time.