refactor: remove CDN tags from feed-map, map, story templates

- feed-map.html.twig: removed MapLibre/toGeoJSON/maplibre-utils CDN tags; added {% do assets.addCss/addJs %} calls directly in partial
- map.html.twig: removed MapLibre/toGeoJSON/maplibre-utils CDN tags; added {% block map_assets %} with Asset Manager registrations
- story.html.twig: removed Scrollama CDN tag (now bundled in main.js as window.scrollama)

All map init and script logic remains unchanged. CDN requests eliminated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vgmzx8VTTTmCskSpQtsLTr
This commit is contained in:
2026-06-22 23:39:22 +02:00
parent 632a3028fa
commit 10354a0760
3 changed files with 6 additions and 8 deletions
+4 -4
View File
@@ -36,10 +36,10 @@
<div class="map-container" id="trip-map"></div> <div class="map-container" id="trip-map"></div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maplibre-gl@4/dist/maplibre-gl.css"> {% block map_assets %}
<script src="https://cdn.jsdelivr.net/npm/maplibre-gl@4/dist/maplibre-gl.js"></script> {% do assets.addCss('theme://css-compiled/map.css') %}
<script src="https://cdn.jsdelivr.net/npm/@mapbox/togeojson@0.16.2/togeojson.min.js"></script> {% do assets.addJs('theme://js/map.js', {group: 'bottom'}) %}
<script src="{{ url('theme://js/maplibre-utils.js') }}"></script> {% endblock %}
<script> <script>
var ENTRIES = {{ map_entries|json_encode|raw }}; var ENTRIES = {{ map_entries|json_encode|raw }};
@@ -11,6 +11,8 @@
show_journey — bool: whether to draw the route connector line between markers show_journey — bool: whether to draw the route connector line between markers
#} #}
{% if map_entries|length > 0 %} {% if map_entries|length > 0 %}
{% do assets.addCss('theme://css-compiled/map.css') %}
{% do assets.addJs('theme://js/map.js', {group: 'bottom'}) %}
<div class="feed-map-wrap"> <div class="feed-map-wrap">
<div class="feed-map" id="{{ map_id }}"> <div class="feed-map" id="{{ map_id }}">
<button class="feed-map-fullscreen-btn" id="{{ map_id }}-fullscreen" aria-label="Expand map"> <button class="feed-map-fullscreen-btn" id="{{ map_id }}-fullscreen" aria-label="Expand map">
@@ -25,9 +27,6 @@
{% endif %} {% endif %}
</div> </div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maplibre-gl@4/dist/maplibre-gl.css">
<script src="https://cdn.jsdelivr.net/npm/maplibre-gl@4/dist/maplibre-gl.js"></script>
<script src="{{ url('theme://js/maplibre-utils.js') }}"></script>
<script> <script>
{% set js_suffix = map_id|replace({'-': '_'})|upper %} {% set js_suffix = map_id|replace({'-': '_'})|upper %}
var MAP_ENTRIES_{{ js_suffix }} = {{ map_entries|json_encode|raw }}; var MAP_ENTRIES_{{ js_suffix }} = {{ map_entries|json_encode|raw }};
@@ -69,7 +69,6 @@
<button class="story-totop" id="story-totop" aria-label="Back to top">↑ Top</button> <button class="story-totop" id="story-totop" aria-label="Back to top">↑ Top</button>
<script src="https://cdn.jsdelivr.net/npm/scrollama@3/build/scrollama.min.js"></script>
<script> <script>
/* ── Hero scroll effect ──────────────────────────────────── */ /* ── Hero scroll effect ──────────────────────────────────── */
(function () { (function () {