WHAT ARE CONTEXTUAL CONTENT VARIABLES?
When you're digging into the open-source toolkit, ACS AEM Commons, you’re going to find something for nearly every Adobe Experience Manager implementation. There are so many features, old and new, that it’s hard to keep track or even identify exactly what you’re looking for! One of the tremendously helpful tools on ACS AEM Commons is Contextual Content Variables (CCVAR). This tool was added in version 5.0.5 and provides a simple service that enables content authoring with variable information.
Or, as ACS Commons describes CCVARs: “Contextual Content Variables is a tool built to enable authors to use content variables directly in their authored text. The tool replaces variables present in the content (either JSON or HTML) on the server-side at render-time, keeping caching enabled for the site and decreasing any impact on performance.”
Let’s use a relatively simple illustration to explain this: CCVAR exposes two common use cases out of the box: page properties and inherited page properties. When enabled, these properties living within AEM are aggregated and exposed as Contextual Content Variables that authors may then leverage within the regular authoring experience. These variables always follow this syntax:
For example, an author may reference the pageTitle property of an AEM page with the page_properties prefix. An author may edit a Title component to display that value (or any other page property within any other component, for that matter) using the CCVAR: