Drops

📘

Quick links

Global variables

Example

Display the current date

{{ today }}

List of all the global variables

NameTypeDescription
siteSitecurrent site. Can not be used by itself. Please refer to the properties of the site
pagePagecurrent page. Can not be used by itself. Please refer to the properties of the page
wagonBooleanTrue if the page is rendered by Wagon or not (i.e. Engine).
sessionHashall the variables stored in the current session
paramsHashall the GET params of the current request
hostStringhost of the server (+ port if different from 80)
base_urlStringscheme (http or https) + host of the server (+ port if different from 80 or 443).
ip_addressStringIP Address of the computer doing the request
pathStringHTTP request path
fullpathStringHTTP request full path (includes query string if present)
urlStringHTTP request url
http_methodStringHTTP request method
refererStringFull path of referring page (includes query string if present)
headBooleanTrue if the request is a HTTP head
getBooleanTrue if the request is a HTTP get
postBooleanTrue if the request is a HTTP post
putBooleanTrue if the request is a HTTP put
deleteBooleanTrue if the request is a HTTP delete
nowTimecurrent time (UTC)
todayDatecurrent date
localeStringcurrent locale
default_localeStringdefault locale of the current site
localesArrayall the locales handled by the current site

Site

Example

Display the name of the current site

{{ site.name }}

Attributes

NameTypeDescription
nameStringname of the site
indexPageroot page of the site
pagesArrayall the pages including even sub pages
domainsArraylist of all the domains the site answers for
seo_titleStringalternative title for the site used for SEO purpose
meta_keywordsStringkeywords used for SEO purpose
meta_descriptionStringdescription used for SEO purpose
metafieldsCollectioncustom fields stored under custom namespaces (Syntax: {{ site.metafields.<namespace>.<field> }}); see Site metafields

Page

Example

Display the title of the current page

{{ page.title }}

Attributes

Name

Type

Description

breadcrumbs

Array

the parent pages and the page itself

children

Array

the direct children

content_type

Content type

example: {{page.content_type.count }}

depth

Integer

the depth in the tree of pages

editable_elements

String

value of an editable element. syntax: page.editable_elements.<block names separated by a .>.<slug of the editable element>. example: ** {{ page.editable_elements.content.main.title }}**

fullpath

String

the complete full path

handle

String

unique identifier for the page (useful for link_to for example)

listed

Boolean

true if the page is included in the menu

meta_description

String

description used for SEO purpose

meta_keywords

String

keywords used for SEO purpose

parent

Page

the parent page. Nil if the page is the root

published

Boolean

true if the page is published

redirect

Boolean

true if the page is a redirection.

redirect_url

String

URL to a remote or a local page.

sections_content

Array

content of global sections and standalone sections and respective blocks (doesn't output content of blocks within {% sections_dropzone %})

seo_title

String

alternative title for the page used for SEO purpose

slug

String

unique identifier for urls, the same as a permalink

templatized

Boolean

true if this page is a template

title

String

title of the page

Content types

Example

Display the number of elements of the entries stored in the Projects model.

{{ contents.projects.size }}

Syntax

{{ contents.<name> }}

name is the slug attribute of your content type.

Attributes

NameTypeDescription
firstContentEntryFirst entry of the collection
lastContentEntryLast entry of the collection
emptyBooleanTrue if the collection of entries is empty
anyBooleanTrue if the collection of entries is NOT empty
sizeIntegerThe total number of entries
countIntegerAlias for size
lengthIntegerAlias for size
group_by_<field name>ArrayThe field name is the name of a "Select" type field of the content type. The method returns an ordered Array of Hash. Each Hash stores 2 keys, name which is the name of the option and entries which is the list of the ordered entries for the option. The Array is ordered based on the order of the options set in the back-office.
<field name>_optionsArrayThe field name is the name of a "Select" type field of the content type. The method returns an ordered Array of available options.

Content entry

Example

Display the name of the first projects. "name" being one of the custom fields described in the content type "Projects".

{{ contents.projects.first.name }}

Attributes

Name

Type

Description

  • label

String

the label as displayed in the back-office to identify the entry

  • permalink

String

unique identifier for urls

  • slug

String

alias for _permalink

next

ContentEntry

the next entry for the parent content type based on the order defined in the back-office. Nil if no entry found

previous

ContentEntry

the next entry for the parent content type based on the order defined in the back-office. Nil if no entry found

seo_title

String

alternative title for the entry used for SEO purpose

meta_keywords

String

keywords used for SEO purpose

meta_description

String

description used for SEO purpose

created_at

Date

Entry creation date time (automatically set)