×
powered by cludo

Cascade CMS Hidden Gems: Velocity Macros and Reusable Formats

Sign up for our newsletter

For Developers - we haven’t forgotten about you!

While many features in Cascade CMS cater to content contributors and marketers, this hidden gem is mainly for developers who build and maintain the structure and logic behind content.

Cascade’s support for Velocity macros and reusable formats offers a powerful way to write cleaner, more modular, and performance-optimized code. Whether building templates, rendering dynamic blocks, or formatting XML content, these tools can make your codebase significantly more manageable.

What are Velocity macros and reusable formats?

In Cascade CMS, Formats are script files, typically written in Apache Velocity, that transform XML data into markup (HTML, XML, JSON, etc.). Macros serve as reusable code blocks within these formats that encapsulate common logic.

You can organize macros into shared formats and import them wherever needed, promoting DRY (Don't Repeat Yourself) principles and increasing site consistency.

Why they matter for developers

Velocity macros and reusable formats bring:

  • Modularity, since you can isolate and reuse logic across multiple templates and formats
  • Maintainability as you can update functionality in one place and reflect changes sitewide
  • Performance by reducing unnecessary database calls by bundling imports
  • Consistency through enforcing structured, uniform rendering across your entire site

These best practices lead to a cleaner codebase, faster page loads, and fewer bugs across your implementation.

Best practices from our Knowledge Base

Based on Hannon Hill’s Velocity Best Practices Guide, here are a few top recommendations:

1. Consolidate Imports to Minimize Database Calls

Each #import directive creates a database call. Instead of importing several separate macros like this:

velocity

CopyEdit

#import ("_shared/macros/stripTags")

#import ("_shared/macros/escapeAll")

#import ("_shared/macros/makeAccessible")

 

Bundle related macros into a single utility format:

velocity

CopyEdit

#import ("_shared/macros/utility")

 

This improves performance and keeps your imports clean.

2. Use Clear Naming Conventions

Name your macros descriptively (e.g., #formatDate, #renderNav, #generateBreadcrumbs) so others can easily understand what they do. It also helps when scanning large shared macro libraries.

3. Take Advantage of Built-in Tools

Cascade comes with Velocity Tools like:

  • $_DateTool – format and manipulate dates

  • $_SortTool – sort lists and arrays

  • $_XPathTool – navigate XML data with ease

Use them to keep your macros efficient and readable.

4. Test Before You Commit

Use Cascade’s “Test Format” feature to validate your macros against actual content before integrating them into templates. It’s an easy way to catch bugs before they affect the site.

Getting Started with Macros

Here’s a quick guide to creating reusable Velocity macros:

  1. Go to Add Content > Format

  2. Choose Velocity as your script type

  3. Use the #macro directive to define your function

  4. Save it in a shared “macros” folder

  5. Import it into your working formats with #import

Bookmark the Velocity Cheat Sheet (PDF) to keep syntax handy.

Conclusion

If you’re a developer working in Cascade CMS, Velocity macros and reusable Formats are among the most powerful tools in your toolkit. They promote smart coding, better site performance, and a smoother handoff between front-end structure and content.

As your implementation grows, these techniques will pay dividends in maintainability and speed. Think of them as your framework that is custom-built for your Cascade-powered site.

To learn more about how Cascade CMS and Clive Web Personalization can help your institution reach more students than ever before, reach out to our team.

Last Updated: Aug 27, 2025 10:00 AM