Skip to content Skip to footer navigation

All Variables

Context-aware variables are always available in your views, giving you access to dynamic information about the current URL, user, loaded entry, site settings, and more.

Type Description
Basename

The basename of the asset, which is the filename with the extension.

Collection

Get the name of the collection the entry belongs to.

Config

Access configuration values from Statamic and Laravel config files.

CSRF Field

Outputs the CSRF token inside a hidden field named _token from the session.

CSRF Token

Output the CSRF token from the session.

Current Layout

The name of the layout currently in use.

Current Template

The name of the template currently in use.

Current Uri

The current URI (URL without domain).

Current Url

The current URL.

Current User

The current user.

Date

Get the date of the entry as a Carbon instance, formatted according to system settings.

Datestamp

Get the timestamp of the entry as an integer. Alias of timestamp.

Datestring

Get the pre-formatted date of the entry as a string.

Edit Url

Get the URL to edit the current page or entry in the Control Panel.

Entries Count

Get the number of entries that use this taxonomy term.

Environment

Outputs the current environment (the value of APP_ENV in your .env file).

Extension

The file extension of the asset.

Filename

The filename of the asset, without the extension.

Focus

The focal point of the asset, defaulting to center (50-50).

Focus Css

The focal point of the asset in a format suitable for the background-position CSS property.

Get

An array of GET variables from query strings in the current URL.

Get Post

Combines both get and post variables, with POST data taking precedence.

Has Timestamp

A boolean indicating whether an entry is time-based.

Height

The height of an image asset, in pixels.

Homepage

The URL of the homepage. Usually the same as site:url.

Id

The unique identifier of the content.

Is Asset

A boolean indicating whether the current content is an asset.

Is Entry

A boolean indicating whether the current content is an entry.

Is Homepage

A boolean indicating whether you're on the homepage.

Is Image

A boolean indicating whether the asset is an image.

Is Term

A boolean indicating whether the current content is a term.

Is Video

A boolean indicating whether the asset is a video.

Last Modified

The last modified time for the content file or asset.

Last Segment

Get the last segment of the current URL.

Live Preview

A boolean indicating whether the current page is being viewed in Live Preview.

Logged In

A boolean indicating whether the visitor is logged in.

Now

The current date/time, formatted according to your display timezone and default time format.

Old

An array of sanitized variables POSTed from the previous request, useful for form validation errors.

Order

Get the order key of the content (the value at the beginning of the filename).

Order Type

Get the order type of an entry (date, alphabetical, or number).

Path

The path to the file, relative to the asset container.

Permalink

Get the absolute URL to the content, including your site URL.

Post

An array of sanitized POST variables from form data submitted to the current URL.

Published

A boolean indicating whether the content is published (not a draft).

Response Code

The HTTP response code of the request (200 for existing URLs, 404 for non-existent ones).

Segment X

Get a specific URL segment by number (e.g., segment_3 returns the third segment).

Site

The current site being targeted in the request, available as a single tag or tag pair.

Sites

A collection containing all configured sites as Site objects that can be looped over.

Size

The file size of the asset in a human-readable format.

Size Bytes

The file size of the asset in bytes. Also available as size_b.

Size Gigabytes

The file size of the asset in gigabytes. Also available as size_gb.

Size Kilobytes

The file size of the asset in kilobytes. Also available as size_kb.

Size Megabytes

The file size of the asset in megabytes. Also available as size_mb.

Slug

The string that identifies your content, usually appearing at the end of the URL.

Taxonomy

Get the name of the taxonomy the term belongs to.

Timestamp

Get the timestamp of the entry as an integer. Alias of datestamp.

Url

Get the relative URL to the content (does not include the site URL).

Width

The width of an image asset, in pixels.

Xml Header

Outputs an XML header tag, useful when Statamic's template parser encodes PHP tags.