CDN cleanup:
- entry.html.twig: remove PhotoSwipe CDN + duplicate JS (main.js handles it)
- dailies.html.twig: remove PhotoSwipe CDN + duplicate JS
- home.html.twig: remove PhotoSwipe CDN + MapLibre CDN + maplibre-utils.js
script tags; add {% block map_assets %} to register map bundle
SVG build pipeline:
- Add lucide-static devDependency; gen-weather-icons.js reads icon SVGs
from node_modules and emits templates/partials/weather-icons.html.twig
- package.json build script now runs gen-weather-icons.js before esbuild
- entry-journal.html.twig includes generated partial instead of hardcoded map
- Rebuild: main.js 83.7kb, map.js 860.7kb, all fonts; zero CDN requests remain
71 lines
2.4 KiB
Twig
71 lines
2.4 KiB
Twig
{% extends 'default.html.twig' %}
|
|
|
|
{% block map_assets %}
|
|
{% do assets.addCss('theme://css-compiled/map.css') %}
|
|
{% do assets.addJs('theme://js/map.js', {group: 'bottom'}) %}
|
|
{% endblock %}
|
|
|
|
{% 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 %}
|
|
|
|
{# page.collection() returns date-descending; reverse to match ascending default on trip page. #}
|
|
{% set all_items = all_items|reverse %}
|
|
|
|
{# 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 %}
|
|
|
|
{% set trip_page = page.parent() %}
|
|
|
|
{% include 'partials/feed-map.html.twig' with {
|
|
'map_entries': map_entries,
|
|
'map_id': 'feed-map',
|
|
'map_var': 'feedMap',
|
|
'link_href': page.parent().url ~ '/map',
|
|
'card_prefix': 'entry-',
|
|
'trip_page': trip_page,
|
|
'show_journey': true
|
|
} only %}
|
|
|
|
<div class="feed-sort-bar">
|
|
<button class="trip-stats-btn" id="feed-sort-toggle" aria-label="Sort: oldest first">↑ Oldest first</button>
|
|
</div>
|
|
<div class="feed">
|
|
{% if all_items|length > 0 %}
|
|
{% for item in all_items %}
|
|
{% set entry = item.page %}
|
|
{% if item.type == 'journal' %}
|
|
{% include 'partials/entry-journal.html.twig' %}
|
|
{% else %}
|
|
{% include 'partials/entry-story.html.twig' %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% else %}
|
|
<p class="feed-empty">No entries yet. The journey is about to begin.</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% endblock %}
|