{{ page.header.title }}
{% set numcalendars = 0 %} {# DONE: find number of ics files, put them in invisible div for automatic processing by calendar.js #}
{% set num_mpics = 0 %}
{% set calendars = [] %} {# empty array #}
{% for file in page.media %}
{#
{% if debug %} {{ dump('file:',file|print_r) }} {% endif %}
#}
{% if (file.filename|ends_with('.ics')) %}
{% if (debug) %} {{ dump('calendarfile:',file.filename|string) }} {% endif %}
{% set calendars = calendars|merge([file.filename|string]) %}
{% set numcalendars = numcalendars + 1 %}
{% endif %}
{% if (file.filename|ends_with('.jpg')) %}
{% if (debug) %} {{ dump('monthpic:',file.filename|string) }} {% endif %}
{% set num_mpics = num_mpics + 1 %}
{% endif %}
{% endfor %}
{% if (debug) %}
{{ dump('numcalendars:',numcalendars) }}
{{ dump('num_pics:',num_mpics) }}
{{ dump('calendars:',calendars|print_r) }}
{% endif %}
{% if (num_mpics|int) >= 12 %} {# 12 pics sollten für 1 Jahr reichen :-) #}
{% endif %}
{% set lang = grav.language.getLanguage %}
{#
{{ lang }}
{{ page.header.lang }}
#}
{% if page.header.lang|length > 0 %}
{% set lang = page.header.lang %}
{% endif %}
{{ lang }}
{% if (numcalendars|int) > 0 %} {# write local page calendars to DOM, json encoded #}
{{ calendars|json_encode() }}
{% endif %}
{{ page.content|raw }}