From c8ee5fc6577b70bdaee85a277598d3bf1eb30e88 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Sun, 31 Aug 2025 16:47:21 +0800 Subject: [PATCH] refactor(article-link): unify featured image rendering with MediaType check --- layouts/partials/article-link/_shortcode.html | 14 ++++---------- layouts/partials/article-link/card-related.html | 16 ++++------------ layouts/partials/article-link/card.html | 12 ++++-------- layouts/partials/article-link/simple.html | 14 ++++---------- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/layouts/partials/article-link/_shortcode.html b/layouts/partials/article-link/_shortcode.html index d22e07d6..3d13844b 100644 --- a/layouts/partials/article-link/_shortcode.html +++ b/layouts/partials/article-link/_shortcode.html @@ -48,18 +48,12 @@ {{ end }} {{ if $target.Params.hideFeatureImage }}{{ $featured = false }}{{ end }} {{ with $featured }} - {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }} - {{ with . }} -
- {{ end }} - {{ else }} - {{ with .Resize "600x" }} - - {{ end }} + {{ $featuredURL := .RelPermalink }} + {{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }} + {{ $featuredURL = (.Resize "600x").RelPermalink }} {{ end }} + {{ end }} - -