Documentation on "scripting"-type instructions used in confluence

In some online examples of formatting etc, I see that there is some sort of language which can be used inside confluence pages (inside the layout pages at least).

For example, on this page:
http://confluence.atlassian.com/display/DOC/Adding+a+Navigation+Sidebar
it has commands like:
#if($action.isPrintableVersion() == false)
#includePage($helper.spaceKey "TreeNavigation")
$body
#else

I haven't been able to find the documentation for all the available scripting commands like these, or for the member functions provided by "$action" for example.

Can I used these sort of commands in any page, or only on page layout boxes? Can I use them in the sidebar code in the documentation theme?

Is there a command to get the current page title being shown, so I can check which page I'm on, and show a different sidebar for various pages? Or, even better, for the sidebar code to retrieve some variable which is defined on the current page, and to choose what to display based on that ?


Thanks for pointing me towards any documentation for this.

1 answer

1 accepted

The "scripting" code you see are Velocity macros. Confluence uses Apache Velocity as their templating engine. These macros can only be used in Velocity template files and not in normal Confluence wiki pages.

See here for more information: https://developer.atlassian.com/display/CONFDEV/Velocity+Template+Overview

And here for the Velocity project page: http://velocity.apache.org

Thanks Sander. I'd seen a few mentions of Velocity previously, but never really found the main page that gives the basics of what it is, and how it's used in Confluence.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

381 views 21 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you