Template Data & Helpers
Last updated
Was this helpful?
Last updated
Was this helpful?
site
— an object of several site-specific properties, contains:
date
— a JavaScript date object for the time that the website was last generated
document
— a JavaScript Object containing the serialised values of our documentModel
(e.g., documentModel.toJSON()
)
req
— dynamic documents will also have this available to the, it is a reference to the current request object created by the framework
content
— when rendering layouts the content
template data variable contains the contents of the rendered child content to be injected into the current layout for rendering
include(relativePath)
return the content of another file at the given path
getEnvironment()
— a string of the current environment(s) we are running under
getEnvironments()
— an array of the current environments we are running under
referencesOthers()
— when called, will set the document's referenceOthers
property to true
getDocument()
— a reference to the current document we are rendering, documents are defined by the which extends the which extends a
getBlock(blockName)
— valid block names are:
scripts
— a collection of scripts to be outputted
styles
— a collection of styles to be outputted
meta
— a collection of meta to be outputted
getPath(path,parentPath)
get a path with respect to the path of the current document
documents
— for all documents
files
— for all files
layouts
— for all files
html
— for all documents and files that result in an HTML file
stylesheet
— for all stylesheet files (includes stylesheet pre-processor files)
getFiles(query, sorting, paging)
get all files that match the arguments, caches the result collection
getFile(query, sorting, paging)
get a single file that matches the arguments
getFilesAtPath(path, sorting, paging)
get a file at the given path, path is processed through getPath
getFileAtPath(path, sorting, paging)
get a single file at the given path, path is processed through getPath
getFileById(id, sorting, paging)
get a single file that has the specified id
getDatabase()
— a collection of all our documents
getCollection(collectionName)
— a collection of a particular sub collection, built in collections are: