Variables and Filters
There are variables and filters exposed to the templates that you have access to.
Variables
meta
Metadata of the Pagedip being used in the render.
guid
- the Pagedip's unique identifieroptions
- theme options for the Pagediptitle
- the title of the Pagediphandle
- the URL handleowner
- the Pagedip owner's username
page
The page document being used in the render.
_id
- The current page's unique identifiertitle
- The page titlepath
- The page's relative path from the Pagedip's base URL.order
- The order in which the page appears in the table of contents
theme
Metadata of this theme.
_id
- The theme's unique identifiertitle
- The theme's titlehandle
- The theme's handledescription
- A description of the themepreview
- Path to a preview Pagedip, shown when selecting a theme within Pagedip.blueprint
- Theme options that can be set on a page-to-page basisglobalBlueprint
- Theme options set globally in the Pagedip's settings pageblockStyles
- An array of custom styles for block elements
template
Metadata of this template.
_id
- Template's unique identifiercname
- The templates's unique nametitle
- The template's titlefilepath
- The path the the template's source filelayout
- The layout template that this template is rendered withinblueprint
- Theme options for this template
pages
An array of page documents for every page in the current Pagedip.
contents
An array of content document for this page. This isn't necessary to use, as the render process will forcefully inject the contents into the proper pd-editable
elements.
Each individual content document has the following fields:
_id
- The content's unique identifiername
- The content name, pairs with the pd-editable field that it will be rendered intovalue
- the content's valuetype
- The content type
getUrl()
A function that returns the current Pagedip's url, which is distinctly different from the page's URL. You can pass additional path parts to the function to add them to the end. To get the current page's URL, use {{ getUrl(page.handle) }}
.
inEdit
A boolean signifying if the current environment is in the Pagedip editor or live. This can be helpful for WYSIWYG specific styling and content.
Theme and Template Options
All data from the theme, template, and embed blueprints are passed into the templates as variables. Properties on these objects can be accessed with dot notation or bracket syntax.
{{ options.options_group_name.option_name }}
{{ options["options_group_name"]["option_name"] }}
Nunjucks Filters
file
Converts a local asset name into the full URL. This is necessary for including assets in a template. The path given to file is relative to the assets directory set by the directories.assets
field in the theme.json
.
style
Wraps a URL in a <link>
tag.
script
Wraps a URL in a <script>
tag.
Example Usage:
Nunjucks builtin filters are also available.