Skip to documentation content

Page Metadata

Page Metadata

The automatic_markup object and methods that set document metadata, robots, timezone, and injection flags.

{{ automatic_markup }} is the reserved root-scope object for the title, meta tags, scripts, and styles the CMS will inject after the template renders. The methods on this page change that state. {% toggle_automatic_markup %} turns injection on or off for the head, the body, and the Edit Page link.

{{ automatic_markup }}

The automatic_markup object contains information about the data and markup that will be added to the page automatically after it is rendered by the template.

Properties
Properties of {{ automatic_markup }} objects
Name Type Description
object_type string Will always be automatic_markup
is_valid boolean Will always be true
title string The page title as it is currently configured to be output as part of the automatic markup. Defaults to {{ entity.browser_title }} but may be set to another value using {% set_title %}
description string The page meta description as it is currently configured to be output as part of the automatic markup. Defaults to {{ entity.meta_description | default:site.default_meta_description }} but may be set to another value using {% set_description %}
robots string The page robots meta information as it is currently configured to be output as part of the automatic markup. Defaults to {{ entity.meta_robots }} but may be set to another value using {% set_robots %}
canonical_url string The page's canonical url meta information as it is currently configured to be output as part of the automatic markup. Defaults to {{ entity.canonical_url }} but may be set to another value using {% set_canonical_url %}
favicon string The favicon for the page as it is currently configured to be output as part of the automatic markup. Does NOT have a default value but may be set using {% set_favicon %}
head_enabled boolean True if the template is currently configured to output automatic markup in the head of the current page. Defaults to true but may be changed using {% toggle_automatic_markup %}
body_enabled boolean True if the template is currently configured to output automatic markup in the body of the current page. Defaults to true but may be changed using {% toggle_automatic_markup %}
show_preview_code boolean True if the template is currently configured to output extra markup (HTML and javascript) as a result of being loaded through the preview UI in Marketpath CMS
show_edit_link boolean True if the template is currently configured to output the "Edit Page" link to the current page. Note that this depends on a number of factors, the most notable of which are the site configuration and the user being logged in to Marketpath CMS at the same time. Can be changed using {% toggle_automatic_markup %}, but only if the pre-requisites for showing the edit link have been met
header_markup string The markup that will be output to the head of the current page. Equivalent to "{{ header_start_markup }}{{ header_end_markup }}"
header_start_markup string The markup that will be output to the beginning of the head of the current page. This includes the browser title and other meta information
header_end_markup string The markup that will be output to the end of the head of the current page. This includes the stylesheets and javascript that were added to the header using {% add_stylesheet %} and {% add_javascript %}
body_markup string The markup that will be output to the end of the body of the current page. This includes the stylesheets and javascript that were added to the body using {% add_stylesheet position:body %} and {% add_javascript position:body %}
header_scripts list The list of javascript linked_src objects that should be output to the document head as part of the automatic markup
body_scripts list The list of javascript linked_src objects that should be output to the document body as part of the automatic markup
stylesheets list The list of stylesheet linked_src objects that should be output to the document head as part of the automatic markup
body_stylesheets list The list of stylesheet linked_src objects that should be output to the document body as part of the automatic markup (most styles should be added to the head and not the body except in rare edge-cases)
output string Deprecated. Contains a long pseudo-random string.

{{ linked_src }}

One script or stylesheet queued for output. The header_scripts, body_scripts, stylesheets, and body_stylesheets lists on {{ automatic_markup }} hold linked_src objects.

Properties
Properties of {{ linked_src }} objects
Name Type Description
object_type string Will always be linked_src
is_valid boolean Will always be true
type string Will either be "javascript" or "stylesheet"
position string Where the stylesheet or javascript markup should be output. Will either be "head", "body", or "in_place"
is_inline boolean Will be true if this should output an inline script or style tag
is_linked boolean Will be true if this should link to the stylesheet or javascript URL
src string The URL of the stylesheet or javascript to link to (if is_linked is true)
value string The contents of the inline script or stylesheet to output (if is_inline is true)
attributes {{ dictionary }} Additional attributes to set on the link, script, or style tag that is produced by this linked_src
output string The HTML markup that this linked_src is configured to produce when output to the template

{% set_title %}

Sets the page title.

{% set_title value %}
Parameters
value requiredexpression

The current title is available at {{ automatic_markup.title }}

Example How to use the set_title method

set_title using a variable and capture expression for more control

Liquid
{%- capture pageTitle -%}
	{{- site.name }} | {{ entity.browser_title -}}
{%- endcapture -%}
{%- set_title pageTitle -%}

Updates the browser title to "[site.name] | [entity.browser_title]" by capturing the new browser title in a variable and then setting the title to the variable.

set_title in a single expression using filters

Liquid
{%- set_title site.name | append: ' | ' | append: entity.browser_title -%}

This example will have the same result as the previous example. It is more concise at the expense of being less flexible.

{% set_description %}

Sets the meta description for the current page, which is output by default as part of an HTML page's {{ automatic_markup }}.

{% set_description value %}
Parameters
value requiredexpression

The current meta description is available at {{ automatic_markup.description }}

Example How to use the set_description method

set_description using a variable and capture expression for more control

Liquid
{%- if entity.meta_description is_valid -%}
	{%- capture pageDescription -%}
		{{- site.name }} says: {{ entity.meta_description -}}
	{%- endcapture -%}
	{%- set_description pageDescription -%}
{%- endif -%}

In this contrived example, the meta description will be updated to "[site.name] says [entity.meta_description]" if the entity meta_description is valid.

set_description in a single expression using filters

Liquid
{%- if entity.meta_description is_valid -%}
	{%- set_description site.name | append: ' says: ' | append: entity.meta_description -%}
{%- endif -%}

This example will have the same result as the previous example. It is more concise at the expense of being less flexible.

{% set_favicon %}

Sets the URL to the favicon for the current page, which is output by default as part of an HTML page's {{ automatic_markup }}.

{% set_favicon value %}
Parameters
value requiredexpression
Should resolve either to the URL of the favicon for the current page (starting with "https://", "http://", or "//") or the image object (by name, guid, or direct reference) May use liquid filters.

This simply changes the URL for the favicon meta tag in the head of the HTML response. It does not take into consideration alternate meta tags and it does not change the response to requests for /favicon.ico
The current favicon URL is available at {{ automatic_markup.favicon }}

Example How to use the set_favicon method

Set favicon from the name of an image

Liquid
{% set_favicon "favicon.ico" %}

Sets the favicon to the image with the name "favicon.ico".

Set favicon from image

Liquid
{%- image img = "favicon" -%}
{%- set_favicon img -%}

Sets the favicon to the specified image object.

Set favicon from URL string

Liquid
{% set_favicon "https://domain.com/path/to/image.ico" %}

Sets the favicon to the specified URL.

{% set_robots %}

Sets the robots meta directive.

{% set_robots value %}
Parameters
value requiredexpression

The current robots meta directive is available at {{ automatic_markup.robots }}

Example How to use the {% set_robots %} tagUse the set_robots tag to set the robots meta directive (e.g. for indexing or noindex).

No index, no follow

Liquid
{%- set_robots "noindex,nofollow" -%}

Instructs search engines not to index the page or follow its links.

Unset the robots meta directive

Liquid
{% set_robots null %} will do the same thing as {% set_robots '' %}

If set_robots is used with a null value or empty string then the robots meta directive will not be output in the HTML.

Set from a variable

Liquid
{%- var meta_instructions = "" -%}
{%- if noindex %}{% set meta_instructions = meta_instructions | append:',noindex' %}{% endif -%}
{%- if nofollow %}{% set meta_instructions = meta_instructions | append:',nofollow' %}{% endif -%}
{%- set_robots meta_instructions | slice: 1 | default:'all' -%}

The meta instructions are dynamically generated based on the presence of the noindex and nofollow variables. If one or the other are present then it will start with a comma which much be removed, and if neither are present than the default value of 'all' will be used, which instructs search engines that there are no restrictions for indexing or serving.

{% set_timezone %}

Sets the default timezone to use when rendering dates and times on the page that do not already have a separate timezone configured.

{% set_timezone value %}
Parameters
value requiredexpression
Should evaluate to a timezone identifier. For the best result, use a well-known timezone ids (eg: "UTC"), the GMT offset (eg: "GMT+5:00"), the full timezone name (eg: "Pacific Standard TIme"), or the full city identifier (eg: "Europe/Amsterdam") May use liquid filters.

Some dates and times do not use the default timezone and will not be affected by this method.

Example Many ways to use the date filterYou can use the date filter either to create a date object or to format a date as a string.
Liquid
{% set_timezone 'UTC' %}

create a date object

Liquid
{{ "2009-09-09" | date }}
Output
9/9/2009 12:00:00 AM
Liquid
{{ "2009-09-09" | date: "D" }}
Output
Wednesday, September 9, 2009
Liquid
{{ 0 | date: "D" }}
Output
Thursday, January 1, 1970
Liquid
{{ 1756239994 | date: "D" }}
Output
Tuesday, August 26, 2025

Defaults to the current date

Liquid
{{"now" | date}}
Output
2009-09-09T00:00:00.0000000+00:00 (or whatever the current date is)

format a date as a string

Liquid
{{request.date | date: "d"}}
Output
9/9/2009
Liquid
{{request.date | date: "D"}}
Output
Sunday, September 9, 2009
Liquid
{{request.date | date: "o"}}
Output
9/9/2009 12:00:00 AM
Liquid
{{request.date | date: "MMMM dd, yyyy"}}
Output
September 09, 2009
Example Set the request timezoneSet the request timezone from a string (e.g. IANA zone) so date/time output uses that zone.
Liquid
{%- set_timezone "America/Indianapolis" -%}
{{- request.date | timezone }}
Output
America/Indianapolis
Liquid
{%- var cityname = "Amsterdam" -%}
{%- set_timezone "Europe/" | append: cityname -%}
{{- request.date | timezone }}
Output
Europe/Amsterdam

{% set_canonical_url %}

Sets the canonical URL for the current page, which is output by default as part of an HTML page's {{ automatic_markup }}.

{% set_canonical_url value %}
Parameters
value requiredexpression

The current canonical URL is available at {{ automatic_markup.canonical_url }}

Example Set the canonical URL for paginated pagesSet the canonical URL for paginated pages so search engines understand the preferred page.
Liquid
{%- if collection.page > 1 -%}
	{%- set_canonical_url entity.full_url | append: '?page=' | append: collection.page -%}
{%- else -%}
	{%- unless entity.canonical_url is_valid -%}
		{%- set_canonical_url entity.full_url -%}
	{%- endunless -%}
{%- endif -%}

{% toggle_automatic_markup %}

Enables or disables the automatic markup at the page level

{% toggle_automatic_markup flags %}
Parameters
flags optionallist
One or more values. May use the variable arguments syntax. Options that control which markup is enabled or disabled

Options

enable optionalvalue
Turns the automatic markup on for the specified options
disable optionalvalue
Turns the automatic markup off for the specified options (default)
header optionalvalue
Turns the header markup on or off
body optionalvalue
Turns the body markup on or off
edit_page optionalvalue
Turns the "Edit Page" button on or off (if applicable)
all optionalvalue
Turns all of the automatic markup on or off (default if neither header, body, or edit_page are specified)

Automatic markup typically only applies to HTML pages. You cannot enable the "Edit Page" button if it would not be displayed on the site by default (ie: either if it has been disabled in the site settings, if it is being viewed from the preview site, or if the current user is not signed in to Marketpath CMS.