From 349de5400913699d6271ea8da9b6c73c8c9c4847 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Thu, 29 Aug 2024 14:05:40 +0800 Subject: [PATCH] :bug: Fix: featuredimagepreview error in summary and RSS --- layouts/_default/summary.html | 6 ------ layouts/partials/feed/rss.html | 11 ++++++----- layouts/partials/init/index.html | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index a72a3db3..8abda62d 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -3,12 +3,6 @@
{{- /* Featured image */ -}} {{- $image := $params.featuredimagepreview | default $params.featuredimage -}} - {{- with $image }} - {{- if not (hasPrefix . "/") }} - {{- $image = (printf "%s%s" $.RelPermalink .) | safeURL }} - {{- end }} - {{- $image = $image | relURL }} - {{- end }} {{- with .Resources.GetMatch "featured-image" -}} {{- $image = .RelPermalink -}} {{- end -}} diff --git a/layouts/partials/feed/rss.html b/layouts/partials/feed/rss.html index c9aa16fa..a4519933 100644 --- a/layouts/partials/feed/rss.html +++ b/layouts/partials/feed/rss.html @@ -26,14 +26,15 @@ {{- end }} {{- range $page := $pages }} {{- $params := .Params | merge .Site.Params.Page }} - {{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fullText }} + {{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fulltext }} {{- $author := partial "function/get-author-map.html" .Params.author }} + {{- $cacheRemoteImages := $params.cacheRemoteImages }} {{- $image := $params.featuredimagepreview | default $params.featuredimage }} - {{- with $image }} - {{- if not (hasPrefix . "/") }} - {{- $image = (printf "%s%s" $page.RelPermalink .) | safeURL }} + {{- with dict "Path" $image "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" }} + {{- $url := urls.Parse $image }} + {{- if not $url.Host | or $cacheRemoteImages.replace }} + {{- $image = .Permalink }} {{- end }} - {{- $image = $image | absURL }} {{- end }} {{- with .Resources.GetMatch "featured-image" }} {{- $image = .Permalink }} diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index b38687e7..1add1a2d 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.10-18643271" -}} +{{- .Scratch.Set "version" "v0.3.10-312b6363" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}}