Template Data & Helpers
Standard Template Data
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 ourdocumentModel
(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 ExpressJS frameworkcontent
— when rendering layouts thecontent
template data variable contains the contents of the rendered child content to be injected into the current layout for rendering
Standard Template Helpers
include(relativePath)
return the content of another file at the given pathgetEnvironment()
— a string of the current environment(s) we are running undergetEnvironments()
— an array of the current environments we are running underreferencesOthers()
— when called, will set the document'sreferenceOthers
meta data property totrue
getDocument()
— a reference to the current document we are rendering, documents are defined by the Document Class which extends the File Class which extends a Backbone ModelgetBlock(blockName)
— valid block names are:scripts
— a collection of scripts to be outputtedstyles
— a collection of styles to be outputtedmeta
— a collection of meta to be outputted
getPath(path,parentPath)
get a path with respect to the path of the current document
Querying
getDatabase()
— a Query-Engine collection of all our documentsgetCollection(collectionName)
— a Query-Engine collection of a particular sub collection, built in collections are:documents
— for all documentsfiles
— for all fileslayouts
— for all fileshtml
— for all documents and files that result in an HTML filestylesheet
— for all stylesheet files (includes stylesheet pre-processor files)
getFiles(query, sorting, paging)
get all files that match the arguments, caches the result collectiongetFile(query, sorting, paging)
get a single file that matches the argumentsgetFilesAtPath(path, sorting, paging)
get a file at the given path, path is processed throughgetPath
getFileAtPath(path, sorting, paging)
get a single file at the given path, path is processed throughgetPath
getFileById(id, sorting, paging)
get a single file that has the specified id
Last updated