refactor: extract date range macro; fix stories.html.twig asset registration

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-24 00:07:26 +02:00
parent 04bcab2d55
commit 24ffa42499
3 changed files with 28 additions and 20 deletions
@@ -1,6 +1,12 @@
{% extends 'partials/base.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 %}
{% import 'macros/date-range.html.twig' as dr_m %}
{% set stories = page.children.published().order('date', 'asc') %}
{# Collect stories that have coordinates for the mini-map #}
@@ -46,10 +52,7 @@
{% set hero = story.media[story.header.hero_image] %}
{% endif %}
{% set date_str = story.date|date('d M Y') %}
{% if story.header.end_date %}
{% set date_str = story.date|date('d M') ~ '' ~ story.header.end_date|date('d M Y') %}
{% endif %}
{% set date_str = dr_m.format_date_range(story.date, story.header.end_date ?? null) %}
<a class="story-card" id="story-{{ story.slug }}" href="{{ story.url }}">
{% if hero %}