Files
godot-website/_includes/events-list.html
Yuri Sizov e666916216 Rework community events using data collections (#628)
- Replace the events page with a generated template
- Convert all events to the data collection format
- Fix various markup issues, typos in texts
- Add collection item templates for articles, showcase, and events
- Fix shadowing in showcase items where `page.xbox` was defined twice
2023-04-24 18:41:54 +02:00

104 lines
2.8 KiB
HTML

<section class="events">
{% comment %}
The best way to create an array in Liquid is to split a string.
{% endcomment %}
{% assign shortlist = "" | split: ',' %}
{% assign fulllist = "" | split: ',' %}
{% assign year = "" %}
{% for event in include.events %}
{% comment %}
Set the initial value, if not set already.
{% endcomment %}
{% if year == empty %}
{% assign year = event.date | date: '%Y' %}
{% endif %}
{% comment %}
Check if we have reached another year, this means we must print out and reset.
{% endcomment %}
{% assign current_year = event.date | date: '%Y' %}
{% if year != current_year %}
{% comment %}
Print the currently tracked year.
{% endcomment %}
{% include events-year.html year=year shortlist=shortlist fulllist=fulllist %}
{% comment %}
Reset the tracking variables and set the currently tracked year.
{% endcomment %}
{% assign shortlist = "" | split: ',' %}
{% assign fulllist = "" | split: ',' %}
{% assign year = current_year %}
{% endif %}
{% comment %}
Generate and store formatted entries for both a shortlist and a full list.
{% endcomment %}
{% comment %}
We want to use the source file name as an id, but Jekyll doesn't expose it
as a ready-made property. So we improvise.
{% endcomment %}
{% assign event_id = event.path | split:"/" | last | split:"." | first %}
{% capture shortlist_value %}
<li>
<span>{{ event.dates_short }}</span>
<a href="#{{ event_id }}">
<em>{{ event.name_short }}</em>
</a>
<span>{{ event.location_short }}</span>
</li>
{% endcapture %}
{% assign shortlist = shortlist | push: shortlist_value %}
{% capture fulllist_value %}
<a id="{{ event_id }}"></a>
<div class="card base-padding event-card">
<h3>{{ event.name }}</h3>
{% unless event.cover_image == empty %}
<img src="{{ event.cover_image }}" alt="{{ event.name }} event banner">
{% endunless %}
{{ event.content }}
<h4>Event details</h4>
<ul class="event-details">
<li><strong>Date:</strong> {{ event.dates }}</li>
<li><strong>Location:</strong> {{ event.location | markdownify }}{% unless event.location_map == empty %} (<a href="{{ event.location_map }}">Show on map</a>){% endunless %}</li>
<li><strong>Entrance fee:</strong> {{ event.entrance_fee | markdownify }}</li>
<li><strong>Registration:</strong> {{ event.registration | markdownify }}</li>
</ul>
</div>
{% endcapture %}
{% assign fulllist = fulllist | push: fulllist_value %}
{% endfor %}
{% comment %}
Print the final year. There is always one after the loop, if there is any at all.
{% endcomment %}
{% if year != "" %}
{% include events-year.html year=year shortlist=shortlist fulllist=fulllist %}
{% endif %}
</section>