From a4da7cea2a79fc26da16213770e163ad8517247a Mon Sep 17 00:00:00 2001 From: razonyang Date: Mon, 15 Apr 2024 22:03:52 +0800 Subject: [PATCH] fix: navigate to external post directly when clicking the featured image --- 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 }}