diff --git a/themes/intotheeast/templates/dailies.html.twig b/themes/intotheeast/templates/dailies.html.twig index ceaa377..6432363 100644 --- a/themes/intotheeast/templates/dailies.html.twig +++ b/themes/intotheeast/templates/dailies.html.twig @@ -1,17 +1,29 @@ {% extends 'default.html.twig' %} {% block content %} -{% set entries = page.collection() %} +{% set journal_entries = page.collection() %} +{% set stories_page = grav.pages.find(page.parent().route ~ '/stories') %} +{% 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) %} {# Collect GPS entries for mini-map #} {% set map_entries = [] %} -{% for entry in entries %} - {% if entry.header.lat is not empty and entry.header.lng is not empty %} +{% for item in all_items %} + {% if item.type == 'journal' and item.page.header.lat is not empty and item.page.header.lng is not empty %} {% set map_entries = map_entries|merge([{ - 'lat': entry.header.lat, - 'lng': entry.header.lng, - 'title': entry.title, - 'url': entry.url + 'lat': item.page.header.lat, + 'lng': item.page.header.lng, + 'title': item.page.title, + 'slug': item.page.slug, + 'url': item.page.url }]) %} {% endif %} {% endfor %} @@ -51,7 +63,10 @@ FEED_ENTRIES.forEach(function(entry, i) { }); L.marker([parseFloat(entry.lat), parseFloat(entry.lng)], { icon: icon }) .addTo(map) - .on('click', function() { window.location = entry.url; }); + .on('click', function() { + var card = document.getElementById('entry-' + entry.slug); + if (card) { card.scrollIntoView({ behavior: 'smooth', block: 'center' }); } + }); }); if (latLngs.length === 1) { @@ -63,9 +78,9 @@ if (latLngs.length === 1) { {% endif %}
- {% if entries|length > 0 %} - {% for entry in entries %} -
+ {% 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] %} @@ -73,47 +88,63 @@ if (latLngs.length === 1) { {% set hero = entry.media.images|first %} {% endif %} - - {% if hero %} -
- {{ entry.title }} -
-
+ + {% 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 %} - - 📍 - {% 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 %} + + {%- 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 %}
-
- {% 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 → -
-
-
+
+

{{ entry.title }}

+

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

+ Read entry → +
+ + + {% else %} +
+ + {% if hero %} +
+ {{ entry.title }} +
+ {% endif %} +
+ ✦ Story +

{{ entry.title }}

+
+
+
+ {% endif %} {% endfor %} {% else %}

No entries yet. The journey is about to begin.

diff --git a/themes/intotheeast/templates/stories.html.twig b/themes/intotheeast/templates/stories.html.twig index 08fd1dc..66a35f2 100644 --- a/themes/intotheeast/templates/stories.html.twig +++ b/themes/intotheeast/templates/stories.html.twig @@ -1,5 +1,9 @@ {% extends 'partials/base.html.twig' %} +{% block nav %} +← Back +{% endblock %} + {% block content %}

{{ page.title }}

Stories coming soon.