Skip to content
This repository has been archived by the owner on Oct 15, 2023. It is now read-only.

2. Conditions

Whilein edited this page May 22, 2021 · 4 revisions

You can insert the text if condition is satisfied

Syntax:

{% if [condition] %}
{% endif %}

Examples:

{% if (user.permission & page.permission) == 0 %}
  <p>You don't have a permission to visit the page</p>
{% endif %}

Also == and != automatically replaces to .equals if objects are strings.

{% if user.name == "Whilein" %}

In Java:

if (getUser().getName().equals("Whilein"))

If you want to check an enums, you have to use # before enum name

{% if user.role == #ADMIN %}
  <p>You are admin!</p>
{% endif %}
Clone this wiki locally