From d71eddfabfe5a204f41d05f956a9200649badb71 Mon Sep 17 00:00:00 2001 From: Olivia206 <olivia.simonet@mmibordeaux.com> Date: Wed, 14 Feb 2024 14:53:30 +0100 Subject: [PATCH] fixed image default partial --- layouts/partials/blocks/templates/posts/large.html | 2 +- layouts/partials/commons/image-default.html | 11 +++++------ layouts/partials/events/event.html | 2 +- layouts/partials/posts/post.html | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/layouts/partials/blocks/templates/posts/large.html b/layouts/partials/blocks/templates/posts/large.html index 77eda214..d29b3dac 100644 --- a/layouts/partials/blocks/templates/posts/large.html +++ b/layouts/partials/blocks/templates/posts/large.html @@ -53,7 +53,7 @@ "sizes" site.Params.image_sizes.sections.events.item ) -}} {{- else -}} - {{- partial "commons/image-default.html" (dict "type" "posts") -}} + {{- partial "commons/image-default.html" "posts" -}} {{- end -}} </div> </article> diff --git a/layouts/partials/commons/image-default.html b/layouts/partials/commons/image-default.html index 6bf324e7..abd7e74a 100644 --- a/layouts/partials/commons/image-default.html +++ b/layouts/partials/commons/image-default.html @@ -1,9 +1,9 @@ -{{ if and site.Params.events.default_image site.Data.website.default_image }} - - {{ $type := .type}} - {{ $image := site.Data.website.default_image }} +{{ $section_type := .}} +{{ $use_default := (index site.Params $section_type).default_image}} +{{ $image := site.Data.website.default_image }} - {{ with index site.Params.image_sizes.sections $type }} +{{ if and $use_default $image }} + {{ with index site.Params.image_sizes.sections $section_type }} {{ $sizes := .items }} {{- partial "commons/image.html" @@ -12,5 +12,4 @@ "sizes" $sizes ) -}} {{ end }} - {{ end }} \ No newline at end of file diff --git a/layouts/partials/events/event.html b/layouts/partials/events/event.html index 461f866d..cc57c585 100644 --- a/layouts/partials/events/event.html +++ b/layouts/partials/events/event.html @@ -86,7 +86,7 @@ "sizes" site.Params.image_sizes.sections.events.item ) -}} {{- else -}} - {{- partial "commons/image-default.html" (dict "type" "events") -}} + {{- partial "commons/image-default.html" "events" -}} {{- end -}} </div> </article> diff --git a/layouts/partials/posts/post.html b/layouts/partials/posts/post.html index f987a41e..ac111562 100644 --- a/layouts/partials/posts/post.html +++ b/layouts/partials/posts/post.html @@ -52,7 +52,7 @@ "sizes" site.Params.image_sizes.sections.events.item ) -}} {{- else -}} - {{- partial "commons/image-default.html" (dict "type" "posts") -}} + {{- partial "commons/image-default.html" "posts" -}} {{- end -}} </div> </article> -- GitLab