From f68544aa49593ec60c16c47e266f4fb5ca688f54 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Mon, 15 Apr 2024 22:05:49 +0800 Subject: [PATCH] fix: navigate to external post directly when clicking the featured image (#764) --- layouts/partials/hb/modules/blog/post/card-img.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/layouts/partials/hb/modules/blog/post/card-img.html b/layouts/partials/hb/modules/blog/post/card-img.html index fa6799cb..7552cc8b 100644 --- a/layouts/partials/hb/modules/blog/post/card-img.html +++ b/layouts/partials/hb/modules/blog/post/card-img.html @@ -1,7 +1,14 @@ {{- $page := . }} +{{- $url := .RelPermalink }} +{{- $external := false }} +{{- with .Params.external_url }} + {{- $url = . }} + {{- $external = true }} +{{- end }} + {{ if $external }}target="_blank" rel="external"{{ end }} + href="{{ $url }}"> {{- $img := "" }} {{- with .Params.images }} {{- $img = index . 0 }}