Variables hold data values or objects. These are the global objects available in HTL:
| Enumerable | Java-backed |
|---|---|
| properties pageProperties inheritedPageProperties |
component componentContext currentDesign currentNode currentPage currentSession currentStyle designer editContext log out pageManager reader request resolver resource resourceDesign resourcePage response sling slyWcmHelper wcmmode xssAPI |
Accessing properties
There are two ways to access the properties of a variable.
1. Dot notation — simpler, and preferred in most cases.
<!--/* access the page title */-->
${currentPage.title}
2. Bracket notation — for accessing properties dynamically, or properties whose names contain characters that are not valid in an identifier.
${currentPage['title']} or ${currentPage["title"]}
Rules for valid names
A name starts with a letter (A–Z, a–z) or an underscore (_). Subsequent characters can also be digits (0–9) or a colon (:).
Accessing Unicode or invalid identifier characters
${properties['title propertyå']}
Accessing members dynamically
${properties[myVarProperty]}
Accessing variables that may be null
${currentNode.lastModified.time.toString}