The cookies object is available on every page, and contains information regarding the cookies sent with the request. Note that this will typically only include cookies for the current or top-level domain on multi-domain sites.
| Name | Type | Description |
|---|---|---|
| is_valid | Boolean | Will always be true |
| keys | list | The list of cookie names on the current request, including cookies that may have been added or removed after the request started processing. |
| * | String | Individual cookies on this request may be accessed using {{ cookies.cookieName }} or {{ cookies['cookie-name'] }} syntax |
| output | String | JSON representation of the cookies object, similar to {{ cookies | inspect: 3, false }} |
The cookies object is copyable, and when copied using the {% copy_to_dictionary %} the keys will be the names of the cookies and the values will be the corresponding cookie objects. You may also treat this object as a list containing all of the cookie names which may be iterated using a {% for %} loop.
Root Scope Reserved Variables
{{ client }}
{{ request }}
string
list
Sets a cookie in the HTTP response.
{% set_cookie cookie_name cookie_value attributes %}
attributes
There are a small number of reserved and forbidden cookie names, the most prominent being "_mp_permissions" - the name of the cookie used by Marketpath for handling permissions. You must use the {% set_client_permission %} and {% unset_client_permission %} methods to manage permissions instead of manipulating the permissions cookie directly.
{% set_title %}
{% set_description %}
{% set_session %}
{% set_timezone %}
{% set_content_type %}
{% set_robots %}
{% set_client %}
{% set_favicon %}
{% set_profile_setting %}
{% set %}
{% set_header %}
{% set_client_permission %}
{% set_dictionary %}
{% unset_cookie %}
{% set_canonical_url %}
{% set_response_code %}
{% set_profile %}
"Unsets" one or more cookies. Because of how cookies work, this will actually ADD the cookie to the response with an expiration date in the past.
{% unset_cookie names %}
{% unset_dictionary %}
{% unset_session %}
{% unset_client %}
{% unset_client_permission %}
{% unset_profile %}
{% unset_profile_setting %}
{% set_cookie %}
Demonstrates how to access custom cookie.
Access custom cookie
CopyHow to use the set_cookie method
CopySet a cookie that expires in 20 minutes
Set a cookie with a reference variable
Set a cookie with a custom statistics string
Demonstrates how to list all cookies in the current request.
List all cookies in the current request
CopyHow to use the unset_cookie method
CopyUnset Cookie
Unset multiple Cookies