From b66f1cdb2d5c1e230cc8938ed8efbc01f9731ae3 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 19 Jun 2026 15:45:06 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20trip=20page=20=E2=80=94=20entry=20count?= =?UTF-8?q?s,=20merged=20feed,=20sticky=20sidebar=20index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/intotheeast/templates/trip.html.twig | 138 ++++++++++++++++++-- 1 file changed, 124 insertions(+), 14 deletions(-) diff --git a/themes/intotheeast/templates/trip.html.twig b/themes/intotheeast/templates/trip.html.twig index c61c60c..ea95525 100644 --- a/themes/intotheeast/templates/trip.html.twig +++ b/themes/intotheeast/templates/trip.html.twig @@ -1,8 +1,22 @@ {% extends 'partials/base.html.twig' %} {% block content %} -{% set tracker_page = grav.pages.find(page.route ~ '/dailies') %} -{% set entries = tracker_page ? tracker_page.children.published() : [] %} +{% set dailies_page = grav.pages.find(page.route ~ '/dailies') %} +{% set stories_page = grav.pages.find(page.route ~ '/stories') %} +{% set journal_entries = dailies_page ? dailies_page.children.published() : [] %} +{% set story_entries = stories_page ? stories_page.children.published() : [] %} + +{% set all_items = [] %} +{% for e in journal_entries %} + {% set all_items = all_items|merge([{'type': 'journal', 'page': e, 'date': e.date}]) %} +{% endfor %} +{% for s in story_entries %} + {% set all_items = all_items|merge([{'type': 'story', 'page': s, 'date': s.date}]) %} +{% endfor %} +{% set all_items = all_items|sort((a, b) => a.date < b.date ? 1 : -1) %} + +{% set journal_count = journal_entries|length %} +{% set story_count = story_entries|length %}

{{ page.title }}

@@ -12,6 +26,10 @@ {% if page.header.date_end %} โ€” {{ page.header.date_end|date('d M Y') }}{% endif %}

{% endif %} +

+ {{ journal_count }} journal {{ journal_count == 1 ? 'entry' : 'entries' }} + {% if story_count > 0 %} ยท {{ story_count }} {{ story_count == 1 ? 'story' : 'stories' }}{% endif %} +

-{% if entries|length > 0 %} -
-

Recent entries

- {% for entry in entries|slice(0, 3) %} - - {{ entry.date|date('d M Y') }} - {{ entry.title }} - {% if entry.header.location_city %} ยท {{ entry.header.location_city }}{% endif %} - - {% endfor %} -
-{% endif %} +
+
+
+ {% if all_items|length > 0 %} + {% for item in all_items %} + {% set entry = item.page %} + {% set hero = null %} + {% if entry.header.hero_image and entry.media[entry.header.hero_image] is defined %} + {% set hero = entry.media[entry.header.hero_image] %} + {% elseif entry.media.images|length > 0 %} + {% set hero = entry.media.images|first %} + {% endif %} + + {% if item.type == 'journal' %} +
+ + {% if hero %} +
+ {{ entry.title }} +
+ + {% if entry.header.location_city or entry.header.location_country %} + + ๐Ÿ“ + {% if entry.header.location_city %}{{ entry.header.location_city|slice(0,20) }}{% endif %} + {% if entry.header.location_city and entry.header.location_country %}, {% endif %} + {% if entry.header.location_country %}{{ entry.header.location_country }}{% endif %} + + {% endif %} +
+
+ {% else %} +
+ + {% if entry.header.location_city or entry.header.location_country %} + + {%- set _loc = [] -%} + {%- if entry.header.location_city -%}{%- set _loc = _loc|merge([entry.header.location_city]) -%}{%- endif -%} + {%- if entry.header.location_country -%}{%- set _loc = _loc|merge([entry.header.location_country]) -%}{%- endif -%} + ๐Ÿ“ {{ _loc|join(', ') }} + + {% endif %} +
+ {% endif %} +
+

{{ entry.title }}

+

{{ entry.summary|striptags|slice(0, 250)|trim }}

+ Read entry โ†’ +
+
+
+ {% else %} + + {% endif %} + {% endfor %} + {% else %} +

No entries yet. The journey is about to begin.

+ {% endif %} +
+
+ + +
{% endblock %}