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
country
Returns the current country.
design_mode
Returns the URL for the assets. You may also use the asset_url filter for more convenient URL building.
device
Returns information about the user device.
host
Returns the current host.
locale
Returns the current locale.
location
Returns information about the user location. Returns null if the location cannot be determined.
page_type
Returns the page type, e.g. product or frontpage.
path
Returns the current request path.
protocol
Returns the protocol of the request.
uri
Returns the full URL for the current page.
Last updated on