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