From ae01ac08b6663ac6d08754d2208feef2fc090a77 Mon Sep 17 00:00:00 2001 From: LLL Date: Fri, 27 Oct 2023 05:13:24 +0700 Subject: [PATCH] feat: improve Cards link behaviour (#153) * clickable feature-card when a link is provided * unclickable card when no link is provided --------- Co-authored-by: Xin --- layouts/shortcodes/card.html | 5 ++--- layouts/shortcodes/hextra/feature-card.html | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html index 40f5913..50204d6 100644 --- a/layouts/shortcodes/card.html +++ b/layouts/shortcodes/card.html @@ -49,9 +49,8 @@ {{- with $image -}} diff --git a/layouts/shortcodes/hextra/feature-card.html b/layouts/shortcodes/hextra/feature-card.html index 9ba4e1b..23a5aab 100644 --- a/layouts/shortcodes/hextra/feature-card.html +++ b/layouts/shortcodes/hextra/feature-card.html @@ -5,9 +5,13 @@ {{- $imageClass := .Get "imageClass" -}} {{- $style := .Get "style" -}} {{- $icon := .Get "icon" -}} +{{- $link := .Get "link" -}} +{{- $external := hasPrefix $link "http" -}} +{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}} -
@@ -25,4 +29,4 @@ {{- with $image -}} {{ $title }} {{- end -}} -
+