Objects

Request

Last updated: · Published:

The request object has attributes of the current state of the web page.

request.user_agent

Input
{{ request.user_agent }}

request.format

Returns format of current request.

Input (on regular url, like /posts)
{{ request.format }}
Output
"html"
Input (on specific url, like /posts.xml)
{{ request.format }}
Output
"xml"

request.fullpath

Returns full path, include query string.

Input
{{ request.fullpath }}
Output
/this/is-a/path?full=1

request.language

Returns a language object for the current language.

Input, on a post that has the german language, e.g. /de/deutches-post
{{ request.language }}
Output
{ "shortcode" => "de", "name" => "German", "url" => "/de/deutches-post" }

request.path

Returns only path, without query string.

Input
{{ request.path }}
Output
/this/is-a/path

request.query

Returns query string. Everything after ‘?’.

Input
{{ request.query }}
Output
full=1&page=5

request.query_object

Converts the query string into an object

Input
{{ request.query_object }}
Output
{"full" => "1", "page" => "5"}
Input
{{ request.query_object.page }}
Output
5

request.url

Returns the full current url.

Input
{{ request.url }}
Output
https://www.my-plate-site.com/this/is-a/path?full=1

request.flash

Contains browser flash messages like form errors.

Input
{{ request.flash.alert }}
{% for error_msg in request.flash.errors %}
  - {{ error_msg }}
{% endfor %}
Output
Something went wrong while sending the message.
- Name is required
- Email is invalid

request.body

Returns the request body for POST and PUT requests. Returns nil on GET requests

Input
{{ request.body }}
Output
{"param" => "yourbodyparam"}

request.request_method

Returns HTTP request method for current request. One of GET, POST or PUT.

Input
{{ request.request_method }}
Output
"GET"

request.inline_cms_active

Returns true when the request comes from a user using the inline CMS. So this returns false when a regular site visitor visits a page. This allows for showing/hiding specific data to CMS users or site visitors.

Input
{% if request.inline_cms_active %}
  Inline CMS is now active
{% else %}
  This will be visible only to persons not logged into the inline CMS
{% endif %}
Output, if user is logged into the inline CMS
Inline CMS is now active
Output, if user is not logged into the inline CMS
This will be visible only to persons not logged into the inline CMS

request.csp_nonce

Returns the nonce that can be used for inline scripts to implement the Content Security Policy of your site properly.

Input
<script nonce="{{ request.csp_nonce }}">
    ...
</script>
Output
<script nonce="Rand)mNonCe">
    ...
</script>

The request object has attributes of the current state of the web page.

request.plate_level

Returns the level for the current user: basic, advanced or developer. Returns an empty string if there is no current user.

Input
{{ request.plate_level }}
Output
"developer"

Copyright © 2025