From 8b8510b27bc48ae69f23cba35b439287fdeaba64 Mon Sep 17 00:00:00 2001 From: leoli Date: Tue, 14 May 2024 17:27:45 +0800 Subject: [PATCH] added 'Context' parameter to handle relative image paths based on the current page --- layouts/about/list.html | 2 +- layouts/authors/single.html | 2 +- layouts/blog/single.html | 2 +- layouts/partials/components/author-card.html | 2 +- layouts/partials/components/blog-card.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/layouts/about/list.html b/layouts/about/list.html index b338f21..8205241 100644 --- a/layouts/about/list.html +++ b/layouts/about/list.html @@ -3,7 +3,7 @@
- {{ partial "image" (dict "Src" .Params.image "Alt" .Title "Class" "mx-auto mb-6" "Size" "200x200") }} + {{ partial "image" (dict "Src" .Params.image "Context" .Page "Alt" .Title "Class" "mx-auto mb-6" "Size" "200x200") }}

{{ .Title }}

{{ .Content }}
diff --git a/layouts/authors/single.html b/layouts/authors/single.html index 36cd1b0..18c3601 100755 --- a/layouts/authors/single.html +++ b/layouts/authors/single.html @@ -6,7 +6,7 @@
{{ $image:= .Params.image }} {{ if $image }} - {{ partial "image" (dict "Src" $image "Alt" .Title "Class" "mx-auto" "Size" "200x200") }} + {{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "mx-auto" "Size" "200x200") }} {{ else if .Params.Email }} - {{ partial "image" (dict "Src" $image "Alt" .Title "Class" "w-full rounded") }} + {{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "w-full rounded") }}
{{ end }}

diff --git a/layouts/partials/components/author-card.html b/layouts/partials/components/author-card.html index 23988af..f28f6d5 100755 --- a/layouts/partials/components/author-card.html +++ b/layouts/partials/components/author-card.html @@ -2,7 +2,7 @@ class="bg-theme-light dark:bg-darkmode-theme-light rounded p-8 text-center"> {{ $image:= .Params.image }} {{ if $image }} - {{ partial "image" (dict "Src" $image "Alt" .Title "Class" "mx-auto mb-6 rounded" "size" "120x120") }} + {{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "mx-auto mb-6 rounded" "size" "120x120") }} {{ else if .Params.Email }} {{ $image:= .Params.image }} {{ if $image }} - {{ partial "image" (dict "Src" $image "Alt" .Title "Class" "mb-6 w-full rounded") }} + {{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "mb-6 w-full rounded") }} {{ end }}