Skip to content

Commit 338ef86

Browse files
committed
2nd attempt to fix URL issues
1 parent 383bb66 commit 338ef86

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

layouts/shortcodes/image-card.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
{{ $url := .Get "url" }}
1919
{{ $class := .Get "class" | default "" }}
2020

21-
<a href="{{ relURL $url }}" class="image-card-link block no-underline hover:no-underline text-inherit hover:text-inherit h-full">
21+
{{/* Handle internal vs external URLs */}}
22+
{{ $finalUrl := $url }}
23+
{{ if and (not (hasPrefix $url "http")) (not (hasPrefix $url "//")) }}
24+
{{ $finalUrl = relref . $url }}
25+
{{ end }}
26+
27+
<a href="{{ $finalUrl }}" class="image-card-link block no-underline hover:no-underline text-inherit hover:text-inherit h-full">
2228
<div class="image-card flex flex-col items-center text-center p-4 border border-redis-pen-300 rounded-lg hover:border-redis-red-500 hover:shadow-md transition-all duration-200 h-full {{ $class }}">
2329
<div class="image-card-img-container mb-4 flex-shrink-0">
2430
<img src="{{ relURL $image }}" alt="{{ $alt }}" class="image-card-img w-28 h-28 object-contain">

0 commit comments

Comments
 (0)