Show all events across all pages with page badges
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m1s

Page summary now loads all upcoming events globally, not just the
current page's. Each card shows an amber page badge when the event
belongs to a different page. Links use the correct page slug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-22 23:05:11 +00:00
parent 39f500c41c
commit dad53fd1b5
5 changed files with 61 additions and 29 deletions

View File

@@ -1,19 +1,30 @@
{# List card for page summary — one entry #}
{% set pi = page_info.get(entry.calendar_container_id, {}) %}
{% set page_slug = pi.get('slug', post.slug) %}
{% set page_title = pi.get('title') %}
<article class="rounded-xl bg-white shadow-sm border border-stone-200 p-4">
<div class="flex flex-col sm:flex-row sm:items-start justify-between gap-3">
{# Left: event info #}
<div class="flex-1 min-w-0">
{% set day_href = events_url('/' ~ post.slug ~ '/calendars/' ~ entry.calendar_slug ~ '/day/' ~ entry.start_at.strftime('%Y/%-m/%-d') ~ '/') %}
{% set day_href = events_url('/' ~ page_slug ~ '/calendars/' ~ entry.calendar_slug ~ '/day/' ~ entry.start_at.strftime('%Y/%-m/%-d') ~ '/') %}
{% set entry_href = day_href ~ 'entries/' ~ entry.id ~ '/' %}
<a href="{{ entry_href }}" class="hover:text-emerald-700">
<h2 class="text-lg font-semibold text-stone-900">{{ entry.name }}</h2>
</a>
{% if entry.calendar_name %}
<span class="inline-block mt-1 px-2 py-0.5 rounded-full text-xs font-medium bg-sky-100 text-sky-700">
{{ entry.calendar_name }}
</span>
{% endif %}
<div class="flex flex-wrap items-center gap-1.5 mt-1">
{% if page_title and page_title != post.title %}
<a href="{{ events_url('/' ~ page_slug ~ '/') }}"
class="inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800 hover:bg-amber-200">
{{ page_title }}
</a>
{% endif %}
{% if entry.calendar_name %}
<span class="inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-sky-100 text-sky-700">
{{ entry.calendar_name }}
</span>
{% endif %}
</div>
<div class="mt-1 text-sm text-stone-500">
{{ entry.start_at.strftime('%H:%M') }}{% if entry.end_at %} &ndash; {{ entry.end_at.strftime('%H:%M') }}{% endif %}

View File

@@ -1,17 +1,28 @@
{# Tile card for page summary — compact event tile #}
{% set pi = page_info.get(entry.calendar_container_id, {}) %}
{% set page_slug = pi.get('slug', post.slug) %}
{% set page_title = pi.get('title') %}
<article class="rounded-xl bg-white shadow-sm border border-stone-200 overflow-hidden">
{% set day_href = events_url('/' ~ post.slug ~ '/calendars/' ~ entry.calendar_slug ~ '/day/' ~ entry.start_at.strftime('%Y/%-m/%-d') ~ '/') %}
{% set day_href = events_url('/' ~ page_slug ~ '/calendars/' ~ entry.calendar_slug ~ '/day/' ~ entry.start_at.strftime('%Y/%-m/%-d') ~ '/') %}
{% set entry_href = day_href ~ 'entries/' ~ entry.id ~ '/' %}
<div class="p-3">
<a href="{{ entry_href }}" class="hover:text-emerald-700">
<h2 class="text-base font-semibold text-stone-900 line-clamp-2">{{ entry.name }}</h2>
</a>
{% if entry.calendar_name %}
<span class="inline-block mt-1 px-2 py-0.5 rounded-full text-xs font-medium bg-sky-100 text-sky-700">
{{ entry.calendar_name }}
</span>
{% endif %}
<div class="flex flex-wrap items-center gap-1 mt-1">
{% if page_title and page_title != post.title %}
<a href="{{ events_url('/' ~ page_slug ~ '/') }}"
class="inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800 hover:bg-amber-200">
{{ page_title }}
</a>
{% endif %}
{% if entry.calendar_name %}
<span class="inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-sky-100 text-sky-700">
{{ entry.calendar_name }}
</span>
{% endif %}
</div>
<div class="mt-1 text-xs text-stone-500">
<a href="{{ day_href }}" class="hover:text-stone-700">{{ entry.start_at.strftime('%a %-d %b') }}</a>

View File

@@ -5,13 +5,10 @@
{# Date header when date changes (list view only) #}
{% set entry_date = entry.start_at.strftime('%A %-d %B %Y') %}
{% if loop.first or entry_date != entries[loop.index0 - 1].start_at.strftime('%A %-d %B %Y') %}
{% set date_href = events_url('/' ~ post.slug ~ '/calendars/' ~ entry.calendar_slug ~ '/day/' ~ entry.start_at.strftime('%Y/%-m/%-d') ~ '/') %}
<div class="pt-2 pb-1">
<a href="{{ date_href }}" class="hover:text-stone-700">
<h3 class="text-sm font-semibold text-stone-500 uppercase tracking-wide">
{{ entry_date }}
</h3>
</a>
<h3 class="text-sm font-semibold text-stone-500 uppercase tracking-wide">
{{ entry_date }}
</h3>
</div>
{% endif %}
{% include "_types/page_summary/_card.html" %}