Files
godot-website/_includes/events/events-list.html
Adam Scott 5997d6e03e Update events layout
- Add `cover_image_caption` (which uses figcaption under the hood)
- Change event details from a list to a table (more semantic and looks
  better)
2025-08-13 08:40:27 -04:00

128 lines
3.2 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/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 %}
<figure>
<img src="{{ event.cover_image }}" alt="{{ event.name }} event banner">
<figcaption>
{{ event.cover_image_caption }}
</figcaption>
</figure>
{% endunless %}
{{ event.content }}
<h4>Event details</h4>
<table class="event-details">
<tbody>
<tr>
<th>Date:</th><td>{{ event.dates }}</td>
</tr>
<tr>
<th>Location:</th><td>{{ event.location | markdownify }}{% unless event.location_map == empty %} (<a href="{{ event.location_map }}">Show on map</a>){% endunless %}</td>
</tr>
{% if event.entrance_fee %}
<tr>
<th>Entrance fee:</th><td>{{ event.entrance_fee | markdownify }}</td>
</tr>
{% endif %}
{% if event.registration %}
<tr>
<th>Registration:</th><td>{{ event.registration | markdownify }}</td>
</tr>
{% endif %}
{% if event.website %}
<tr>
<th>Website:</th><td><a href="{{ event.website }}">{{ event.website }}</a></td>
</tr>
{% endif %}
</tbody>
</table>
</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/events-year.html year=year shortlist=shortlist fulllist=fulllist %}
{% endif %}
</section>