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

5. Case statement

Whilein edited this page May 22, 2021 · 2 revisions

You cannot to include the file in rendertime, i.e. insert the value to include method.

But you can use case statement:

{% case [path] (: [from]) %}
{% endcase %}

For example:

{% case page.name : ["header", "footer", "body"] %}
  {% include [$].html %}
{% endcase %}

As you can see the include has [$] in path, it replaces to page.name ("header", "footer" or "body")

Also you can use an enums

enum PageType {
  HEADER, FOOTER, BODY;

  String getName() {
    return name().toLowerCase();
  }
}
{% case page.type %}
  {% include [$.name].html *>
{% endcase %}
Clone this wiki locally