{% extends 'default.html.twig' %} {% block content %} {% 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 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': item.page.header.lat, 'lng': item.page.header.lng, 'title': item.page.title, 'slug': item.page.slug, 'url': item.page.url, 'force_connect': item.page.header.force_connect ? true : false, 'transport_mode': item.page.header.transport_mode ? item.page.header.transport_mode : null }]) %} {% endif %} {% endfor %} {# Collect GPX URLs from parent trip page for connector algorithm #} {% set trip_page = page.parent() %} {% set gpx_urls = [] %} {% for name, media in trip_page.media.all %} {% if name|split('.')|last == 'gpx' %} {% set gpx_urls = gpx_urls|merge([trip_page.url ~ '/' ~ name]) %} {% endif %} {% endfor %} {% if map_entries|length > 0 %}
View full map →
{% 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 %}
{% if hero %}
{{ entry.title }}
{% endif %}
✦ Story

{{ entry.title }}

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

No entries yet. The journey is about to begin.

{% endif %}
{% endblock %}