From b70eaa9c6baec2366e335af99d871537b01a4071 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 19 Oct 2023 18:28:01 +0100 Subject: [PATCH] feat: support animated featured images (GIFs) Add support for animated GIFs (e.g. featured.gif) in instances of the featured image in page header and all views --- modules/wowchemy/layouts/partials/page_header.html | 7 ++++--- modules/wowchemy/layouts/partials/views/card.html | 3 ++- modules/wowchemy/layouts/partials/views/compact.html | 3 ++- modules/wowchemy/layouts/partials/views/masonry.html | 3 ++- modules/wowchemy/layouts/partials/views/showcase.html | 7 +++++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/modules/wowchemy/layouts/partials/page_header.html b/modules/wowchemy/layouts/partials/page_header.html index b6dd6f17..b03f82e3 100644 --- a/modules/wowchemy/layouts/partials/page_header.html +++ b/modules/wowchemy/layouts/partials/page_header.html @@ -50,14 +50,15 @@ {{ $image_container := "" }} {{ if eq $placement 2}} {{ $image_container = "container" }} - {{ $image = $featured.Fit "1200x2500 webp" }} + {{ $image = $featured.Fit "1200x2500" }} {{else if eq $placement 3}} {{ $image_container = "container-fluid" }} - {{ $image := $featured.Fit "2560x2560 webp" }} + {{ $image := $featured.Fit "2560x2560" }} {{else}} {{ $image_container = "article-container" }} - {{ $image = $featured.Fit "720x2500 webp" }} + {{ $image = $featured.Fit "720x2500" }} {{end}} +{{ if ne $image.MediaType.SubType "gif" }}{{ $image = $image.Process "webp" }}{{ end }}

{{ $title }}

diff --git a/modules/wowchemy/layouts/partials/views/card.html b/modules/wowchemy/layouts/partials/views/card.html index 691acafb..381e50bd 100644 --- a/modules/wowchemy/layouts/partials/views/card.html +++ b/modules/wowchemy/layouts/partials/views/card.html @@ -44,7 +44,8 @@ {{ $resource := partial "functions/get_featured_image.html" $item }} {{ $anchor := $item.Params.image.focal_point | default "Smart" }} {{ with $resource }} - {{ $image := .Fill (printf "808x455 webp %s" $anchor) }} + {{ $image := .Fill (printf "808x455 %s" $anchor) }} + {{ if ne $image.MediaType.SubType "gif" }}{{ $image = $image.Process "webp" }}{{ end }}
{{ $resource := partial "functions/get_featured_image.html" $item }} {{ with $resource }} - {{ $image := .Resize "150x webp" }} + {{ $image := .Resize "150x" }} + {{ if ne $image.MediaType.SubType "gif" }}{{ $image = $image.Process "webp" }}{{ end }} {{ $item.Title }} diff --git a/modules/wowchemy/layouts/partials/views/masonry.html b/modules/wowchemy/layouts/partials/views/masonry.html index 06faa786..a315c9b4 100644 --- a/modules/wowchemy/layouts/partials/views/masonry.html +++ b/modules/wowchemy/layouts/partials/views/masonry.html @@ -22,7 +22,8 @@