Sets a cookie on the HTTP response to be returned to the user.
Syntax
{% set_cookie cookieName cookieValue [expires:"date expires"] [path:"/cookie/path"] [domain:".domain.name"] [secure:true] [httponly:true] [samesite:"none or lax or strict" %}
If cookieName starts with '&', it will be treated as a reference variable, which will be dereferenced to the cookie name that will actually be set.
Examples
{% var sectioncookie = 'accountspage' %}
{% var sectioncount = cookies[sectioncookie] | to_int | plus: 1 %}
{% set_cookie §ioncookie sectioncount %}
{% var expiresDate = "now" | add_minutes: 20 %}
{% set_cookie loginsection "lastsection=accounts" expires:expiresDate path:"/protected" domain:".parentdomain.com" %}
{% if session.allowed and permissions.allow_public_statistics %}
{% capture statisticsString -%}
SessionStart: {{session.start_date | date: 'MMMM dd, yyyy, H:mm:ss'}}
SessionRequests: {{session.num_requests}}
LastRequest: {{request.date | date: 'MMMM dd, yyyy, H:mm:ss'}}
<
>
{%- endcapture %}
{% set_cookie site_statistics statisticsString %}
{% endif %}