Home

Page Model

There are a number of values which are always available to page and post templates. Some are defined by the project, some are specific to the page type (page or post), and some are calculated.

It is important to understand the difference between Pages and Posts.

Some values are prefixed with the @ symbol - these allow you to link between pages, posts, and other navigation elements.

Project Elements

The following are defined in cantilever.yaml and are prefixed with project (e.g. to display the author name, type {{ project.author }}.

KeyNotes
projectName
author
dateFormatDefault date format for project, e.g. dd/MM/yyyy
dateTimeFormatDefault date & time format, e.g. HH:mm dd/MM/yyyy

Common Elements

These elements are common to Pages and Posts.

KeyNotes
titleEvery page or post will have a title
URLCalculated URL, more accurately the URI which follows the domain name

Post Elements

These elements are specific to Posts.

KeyNotes
bodyThe complete content of the blog post as rendered HTML. Include it with the triple-brace{{{ body }}} notation.
dateAll Posts will have a date.
@prevReturns the previous post to this one, i.e. post that precedes this.For instance, in theposts template, use this to link to the previous post:{{@prev.title}}
@nextReturns the next post which follows this one
@firstReturns the very first post in the project
@lastReturns the latest, most recent post in the project

Page Elements

These elements are specific to Pages.

KeyNotes
keyRaw file name for the page
lastModifiedDate and time the page source file was updated
pagesNOT IMPLEMENTED A tree structure which will allow you to access other pages and their metadata (but notbodycontent)
postsNOT IMPLEMENTED A list of all the Posts in the project, so that you can access their titles and metadata (but not body content)

Helper Functions

There are a handful of functions that let you control or modify how content is rendered. These are implemented as Handlebars functions.

FunctionPurposeExampleResult
upperConvert to upper-case{{ upper project.siteName }}CANTILEVER
slugifyConvert a string into something safe for a URL{{ slugify title }}"Project Model" becomes "project-model"
localDateFormat a date as a string{{ localDate lastUpdatedDate }}"2023-10-21T07:23:23:8+8207519Z" becomes "21/10/2023"
takeTake the first n elements from a list and loop to render them{{ take posts "5" }}Loop through the first five most recent posts