Skip to Content

Request

The request object provides information about the current HTTP request, such as country, device, locale, and URL.

Usage Example

{%- comment -%} Show request info for debugging {%- endcomment -%} <ul> <li>Country: {{ request.country.name }}</li> <li>Locale: {{ request.locale.code }}</li> <li>Device: {{ request.device.type }}</li> <li>Host: {{ request.host }}</li> <li>Path: {{ request.path }}</li> <li>Protocol: {{ request.protocol }}</li> <li>Full URL: {{ request.uri }}</li> </ul>

Properties

design_mode

Returns “edit” or “view” if page is rendered in the designer, otherwise false.

device

Returns information about user device. Please note that the data is based on the user agent string which is modifiable by the user.

location

Returns information about user location. Location is a guess based on the user ip address. Returns null if the location cannot be determined.

design_mode

Returns the URL for the assets. You may also use the asset_url filter for more convenient URL building.

host

Returns the current host.

locale

Returns the current locale.

country

Returns the current country.

path

Returns the current request path.

page_type

Returns the page type, i.e. product or frontpage.

uri

Returns the full URL for the current page.

protocol

Returns the protocol of the request.