Skip to content
Snippets Groups Projects
event-list.html 4.65 KiB
{% include top.html %}

<body>

    {% include header.html %}

    <main>
        {% include title_image.html %}

        <section class="events-container">
            {% comment %}
                Events are sorted depending whether they are in the past or in the future.
                Upcoming events are sorted from near future to far future.
                Past events are sorted most recent to least recent.
                In both cases the list is a truncated version of the complete events list,
                where the pivot is the current date.
                If no past events are available a placeholder text will be used instead.

                Example:
                    P0  P1  P2  today  F0  F1    (events)
                    *---*---*-----*----*---*---> (time)

                   will yield the event order (top to bottom): F0, F1, (separator) P2, P1, P0.
            {% endcomment %}

            {% assign sorted_events = site.events | sort: "start.date" %}
            {% assign sorted_events_reversed = site.events | sort: "start.date" | reverse %}
            {% assign today = "now" | date: "%Y-%m-%d" %}

            <h1 id="upcoming_events" class="events-section-heading">Upcoming Events</h1>

            <div class="rss-events-container">
                <a class="rss-events-button" href="{{ '/feed/events.xml' | relative_url }}"
                   title="subscribe to feed"
                   type="application/atom+xml"
                   download>
                    <i class="fas fa-rss"></i>
                </a>
            </div>

            {% assign has_upcoming_events = false %}
            {% for event in sorted_events %}
            {% if event.start.date < today %}
                {% continue %}
            {% endif %}
            {% assign has_upcoming_events = true %}
            <article class="list-entry">
                <div class="preview">
                    <h1>
                        <a href="{{ event.url | relative_url }}">
                            {{ event.title }}
                        </a>
                    </h1>

                {% if event.excerpt_separator != '' %}
                    <div class="excerpt-content">
                        {{ event.excerpt }}
                    </div>
                    {% else %}
                    <div class="no-excerpt-content">
                        {{ event.content }}
                    </div>
                {% endif %}
                    <a href="{{ event.url | relative_url }}" >
                        <span>&nbsp;more…&nbsp;</span>
                    </a>
                </div>

                <div class="digest-container">
                    {% include event_digest.html event=event %}
                </div>

            </article>
            {% endfor %}

            {% if has_upcoming_events == false %}
            <article class="list-entry">
                <p>
                    There are no upcoming events right now ... stay tuned.
                </p>
            </article>
            {% endif %}

            <hr class="horizontal-line across_whole_page" />

            <h1 id="past_events" class="events-section-heading">Past Events</h1>

            {% assign has_past_events = false %}
            {% for event in sorted_events_reversed %}
            {% if event.start.date >= today %}
                {% continue %}
            {% endif %}
            {% assign has_past_events = true %}
            <article class="list-entry">
                <div class="preview">
                    <h1>
                        <a href="{{ event.url | relative_url }}">
                            {{ event.title }}
                        </a>
                    </h1>

                {% if event.excerpt_separator != '' %}
                    <div class="excerpt-content">
                        {{ event.excerpt }}
                    </div>
                    {% else %}
                    <div class="no-excerpt-content">
                        {{ event.content }}
                    </div>
                {% endif %}
                    <a href="{{ event.url | relative_url }}" >
                        <span>&nbsp;more…&nbsp;</span>
                    </a>
                </div>

                <div class="digest-container">
                    {% include event_digest.html event=event %}
                </div>

            </article>
            {% endfor %}

            {% if has_past_events == false %}
            <article class="list-entry">
                <p>
                    There are no past events right now.
                </p>
            </article>
            {% endif %}

        </section>
    </main>

    {% include footer.html %}

</body>

</html>