Skip to documentation content

Page

Page

Reserved root-scope inputs on every page load, and how they relate to entity-driven templates.

Every page is produced by processing templates against reserved root-scope inputs. Those names are always present and cannot be reassigned: request, entity, site, page_view, automatic_markup, and others. Templates can load more data with methods and filters, but they cannot replace these reserved names.

Entity is the page’s primary content record and is always set. Do not wrap {{ entity }} or {{ entity.has_url }} in is_valid. The Entity Object and Entity-Driven Pages (in this section) covers using entity in page templates and in partials that receive it under another name.

Working with the Request, the next Building Sites topic, covers query parameters and POST data. Page Metadata covers {{ automatic_markup }}, extra scripts and styles, and title, description, and robots tags. For object types, properties, and the full catalog, see Objects Overview.

Root Scope Reserved Variables

Every page on the site is created by processing templates using specific pre-defined inputs. These reserved variables are present on the root scope of every pageload.

Properties
Properties of Root Scope Reserved Variables objects
Name Type Description
site {{ site }} An object containing information about the current site - including the custom site settings
request {{ request }} An object containing information about the current request
client {{ client }} An object containing information about the current "client" - such as the "UserAgent", the first request date, the number of client sessions and pages visited, custom client properties, and more
cookies {{ cookies }} An object containing all of the cookies from the current request (can also be accessed via the client or request objects)
client_permissions {{ client_permissions }} An object containing the permissions that are set for the current client. Can also be accessed via the client object
session {{ session }} An object containing information about the current "session", including the session start date, when it will expire if the user does not make any further requests, how many and which pages they have visited, custom client properties, and more.
automatic_markup {{ automatic_markup }} An object containing information about the currently-configured behavior of the automatic page markup
header_tags object Deprecated. A placeholder primarily used to inject information into the document header - such as the browser title, meta information, and any stylesheets or javascript added using the {% add_stylesheet %} and {% add_javascript %} tags. Use of this object is entirely optional - if not included in the template then this information will automatically be output directly before the tag in your HTML output
body_tags object Deprecated. A placeholder used to inject all of the javascript added to the body using {% add_javascript position:'body' %}. This is also a placeholder for the script that enables the "Edit Page" button to be displayed on your live site when you are logged into Marketpath CMS and viewing your site via https. Use of this object is entirely optional - if not included in the template then this information will automatically be output directly before the tag in your HTML output.
auth {{ auth }} An object containing the results of any authentication methods that have been run. Initially, the only relevent information in this object is {{ auth.logged_in }}, although additional information may be stored on this object after calling various other {% auth %} methods
entity {{ entity }} An object containing information about the entity attached to this page. The entity object loaded on the page will be the specific entity type the page was created with (ie: Article, Blog, Blog Post, etc...). See the list of possible Entity Type objects in the menu on the left
mp_editor_preview boolean Will be true if viewing the page as an administrator in the edit page preview UI. Otherwise will remain undefined
profile {{ profile }} If the user is currently logged in as a profile, this will reference an object containing information about the profile that they are logged in as
error_code integer Only applies to error pages, in which case this will be the HTTP error code to be returned with the response
error_message string Only applies to error pages, in which case this will be the error message for the most immediate error that caused the error page to be needed
inner_exception string Only applies to error pages that were required in order to handle an error that occurred while processing another error page, in which case this will be the error message for the original error that caused the first error page to be needed