Last updatedSep 25, 2019

Velocity template overview

Velocity is a server-side template language used by Confluence to render page content. Velocity allows Java objects to be called alongside standard HTML.

If you are are writing a user macro or developing a plugin you may need to modify Velocity content.

Example usage

A variable in velocity looks like this:

1
$foo 

To set a variable:

1
#set ($message = "Hello")

A basic if statement:

1
2
3
#if ($message == "Hello")
   Message received and is "Hello"
#end 

A velocity variable which evaluates to null will simply render as the variable name.

See the Velocity user guide for a more comprehensive introduction to Velocity.