Last updated Apr 2, 2024

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
2
$foo 

To set a variable:

1
2
#set ($message = "Hello")

A basic if statement:

1
2
#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.

Rate this page: