feat: past trips archive with trip cards and entry counts
This commit is contained in:
@@ -1,22 +1,33 @@
|
||||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
<h1 class="trips-heading">Past Trips</h1>
|
||||
{% set trips = page.children.published() %}
|
||||
{% if trips|length == 0 %}
|
||||
<p>No trips yet.</p>
|
||||
<p class="feed-empty">No trips yet.</p>
|
||||
{% else %}
|
||||
<ul class="trips-list">
|
||||
<div class="trips-list">
|
||||
{% for trip in trips %}
|
||||
<li>
|
||||
<a href="{{ trip.url }}">
|
||||
<strong>{{ trip.title }}</strong>
|
||||
{% set dailies_page = grav.pages.find(trip.route ~ '/dailies') %}
|
||||
{% set stories_page = grav.pages.find(trip.route ~ '/stories') %}
|
||||
{% set journal_count = dailies_page ? dailies_page.children.published()|length : 0 %}
|
||||
{% set story_count = stories_page ? stories_page.children.published()|length : 0 %}
|
||||
<a class="trip-card" href="{{ trip.url }}">
|
||||
<div class="trip-card-title">{{ trip.title }}</div>
|
||||
<div class="trip-card-meta">
|
||||
{% if trip.header.date_start %}
|
||||
<span>{{ trip.header.date_start|date('d M Y') }}</span>
|
||||
<span class="trip-card-dates">
|
||||
{{ trip.header.date_start|date('M Y') }}
|
||||
{% if trip.header.date_end %} — {{ trip.header.date_end|date('M Y') }}{% else %} — Ongoing{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
<span class="trip-card-counts">
|
||||
{{ journal_count }} journal {{ journal_count == 1 ? 'entry' : 'entries' }}
|
||||
{% if story_count > 0 %} · {{ story_count }} {{ story_count == 1 ? 'story' : 'stories' }}{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user