diff --git a/themes/intotheeast/blueprints/trip.yaml b/themes/intotheeast/blueprints/trip.yaml index 6e22b60..f913581 100644 --- a/themes/intotheeast/blueprints/trip.yaml +++ b/themes/intotheeast/blueprints/trip.yaml @@ -39,6 +39,7 @@ form: header.cover_image: type: pagemediaselect + accept: ['.jpg', '.jpeg', '.png', '.webp', '.gif'] label: 'Cover Image' help: 'Pick from images uploaded to this trip page. Shown on the trips listing and the trip-page banner. Falls back to the first journal entry photo if left unset.' diff --git a/themes/intotheeast/templates/macros/cover.html.twig b/themes/intotheeast/templates/macros/cover.html.twig index bd0ed64..8b7b3e3 100644 --- a/themes/intotheeast/templates/macros/cover.html.twig +++ b/themes/intotheeast/templates/macros/cover.html.twig @@ -10,7 +10,10 @@ 3. else nothing. A set-but-missing cover_image (deleted/moved file) is `is not defined` in page media, so it falls through to the auto-pick rather than rendering a - broken image (R11). + broken image (R11). Resolution matches against `media.images` (not all + media), so a non-image selection — e.g. a `.gpx` from the trip page's own + media, which the picker used to offer — also falls through instead of + routing a non-image Medium into cropResize. Twig macros can only emit strings — they cannot return a Medium object — so resolution and rendering live together in one macro: it emits the @@ -22,8 +25,8 @@ #} {% macro render(trip_page, alt, w, h, wrapper_class, sizes) %} {%- set cover = null -%} -{%- if trip_page.header.cover_image and trip_page.media[trip_page.header.cover_image] is defined -%} - {%- set cover = trip_page.media[trip_page.header.cover_image] -%} +{%- if trip_page.header.cover_image and trip_page.media.images[trip_page.header.cover_image] is defined -%} + {%- set cover = trip_page.media.images[trip_page.header.cover_image] -%} {%- else -%} {%- set dailies_page = grav.pages.find(trip_page.route ~ '/dailies') -%} {%- if dailies_page -%}