Save list of constants

make a custom macro and import it.

make a file called const.jinja inside custom_templates

Inside the file…

{% set weekdays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'] %}

Then in your template

{% from 'const.jinja' import weekdays %}
{{ weekdays[(now().weekday() + 1) % 7] }}

Or you could try out my easy-time library for jinja that does this already. If your language isn’t supported, I can help you add it.

1 Like