Site

Site

{{ site }}

The site object is available on every page, and contains information about the current site. This information is the same on every page for the site.

Properties of {{ site }} objects
Name Type Description
is_valid Boolean Will always be true
guid String The unique identifier for the site
name String The name of the site
default_domain_name String The domain name of the default domain for the site
default_timezone String The default timezone for the site
default_meta_description String The default meta description for pages on the site
session_length Integer The number of minutes that sessions will remain active between requests on the current site
favicon String The URL for this site's favicon (if specified)
liveedit_enabled Boolean True if "live editing" is enabled for this site. Note that this only indicate whether it is enabled. To know whether or not the edit link will be displayed, use {{ automatic_markup.show_edit_link }} instead
profiles_enabled Boolean True if profiles are currently enabled for this site
signup_enabled Boolean True if users are allowed to sign up for their own profiles directly from the live site
profile_id_equals_email Boolean True if profiles on this site should use the same value for their id and email. False if the id and email may be different
settings dictionary An object containing all of the site-wide settings for the site currently being viewed. You can query the settings directly using {{ site.settings['setting-name'] }} or using the shortcut {{ site.setting-name }}
output String A json representation of the site object

The site object is copyable, and when copied will copy all of the site settings to the resulting dictionary.

Related

{{ timezone }}

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.

object

May be any object, including simple, complex and list objects. In some cases may even include symbols and null.

{{ 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.

{{ dictionary }}

Object containing a list of key-value pairs where the keys are unique.

{{ request }}

The request object is available on every page, and contains information regarding the HTTP request that may be useful for serving and rendering the page.

string

Can be any text, from the empty string ("") to the full HTML output of the template. When used alone in a conditional, all strings evaluates as true - even if they are empty or a value such as "0" or "false".

number

Can be any number, including integers, decimals, or the value 0. Any value - including 0 - evaluates as true when used alone in a conditional.

{{ url }}

Field containing a URL.

{{ profile }}

{{ time }}

Represents a specific instant in a specific timezone.

integer

A whole (non-fractional, non-decimal) number. May be 0. Any value - including 0 - evaluates as true when used alone in a conditional.

boolean

True or False

{{ session }}

The session object is available on every page, and contains information about the user's current session. Note that most of these properties are only meaningful if the user has allowed permission for sessions. Additionally, sessions require cookies in order to work. Requests made without cookies (such as by bots or browsers with cookies disabled) or without permission for sessions will always behave like an initial page-load without existing session information. The session object is one of a handful of simple mechanisms to enable personalization on your site. Used well, these can be powerful tools for developers and website owners.

{{ profiles }}

Contains multiple profiles.

Examples

How to use the set_title method

Copy

set_title using a variable and capture expression for more control

{%- 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

{%- 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.

Demonstrates how to using Capture to create page descriptions.

Using Capture to create page descriptions

Copy
{%- capture page_description -%}
{{- page.browser_title }} | {{ site.name }}:
{%- unless page.browser_title contains entity.title -%}
[{{ entity.title }}]
{%- endunless -%}
{{- page.meta_description | truncate: 50 '...' -}}
{%- endcapture -%}
The page description is "{{ page_description | escape }}"