Velocity Scripting

Last Updated: Jun 11, 2024
documentation for the dotCMS Content Management System

For traditional front end development and scripting, dotCMS uses Apache Velocity — an easy to use template engine. By exposing Java methods as understandable tools (Viewtools), dotCMS frees web developers to focus on building a powerful dynamic site without the need to write Java code.

Velocity can be used in templates, containers, custom fields and contentlets within dotCMS. It can also be used to create custom API endpoints and rest methods that are needed by modern web applications. While this sounds unusual, Velocity is actually used in a similar fashion by AWS's API gateway product that require custom logic and scripting.

dotCMS exposes a number of Viewtools that ship with Velocity, as well as some additional dotCMS-specific tools. For a list of tools exposed, see the documentation on the toolbox.xml, which is the configuration file for viewtools.

Velocity resources, such as macros, are cached in the Velocity2 region, which can be easily flushed through the Cache tab of the Maintenance panel.

To experiment with code before you deploy, try the Velocity Playground in the Admin Panel.

On this page

×

We Dig Feedback

Selected excerpt:

×