Available Data
Access Project Properties
Properties from the current environment can be used within templates but most of them need to be passed through using the setProps
command in the hooks.js file first. The node object is always available.
const transformHook = (rw) => {
// Expose project, page and component objects to the template, node is always available
rw.setProps({
project: rw.project,
page: rw.page,
component: rw.component
})
}
exports.transformHook = transformHook;
With this in place, we gain access to the following within template files.
Project Properties
{{project.title}}
String
{{project.mode}}
String
{{project.siteURL}}
String
{{project.language}}
String
{{project.enableSocialTags}}
Boolean
{{project.allowDarkMode}}
Boolean
{{project.logo.url}}
String
{{project.logo.alt}}
String
Page Properties
{{page.id}}
String
{{page.title}}
String
{{page.menuTitle}}
String
{{page.filename}}
String
{{page.ext}}
String
{{page.language}}
String
{{page.navLevel}}
Integer
Navigation level of the page
{{page.absolutePath}}
String
{{page.docRootPath}}
String
{{page.projectResourcesPath}}
String
Path to the project resources
{{page.isFolder}}
Boolean
Does this page represent a folder
{{page.isPage}}
Boolean
Is this a regular Elements page
{{page.isCode}}
Boolean
Is this a code file
{{page.isLink}}
Boolean
Is this a link URL
{{page.displayInMenu}}
Boolean
Should the page be shown in menus
{{page.isDraft}}
Boolean
Draft pages are not published
{{page.icon.url}}
String
Path to the page icon
Node Properties
The node object is always passed into templates and contains the following properties.
{{node.id}}
String
{{node.title}}
String
{{node.parent.id}}
String
{{node.parent.container}}
String
{{node.backendPath}}
String
Path to the node's backend folder.
Component Properties
{{component.title}}
String
{{component.group}}
String
{{component.version}}
Integer
{{component.build}}
Integer
{{component.assetPath}}
String
Path to component assets
{{component.siteAssetPath}}
String
Path to component site assets
{{component.sharedAssetPath}}
String
Path to pack shared assets
Last updated