diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index e9836a15..21a1e19b 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -10,7 +10,7 @@ {{- if and $dest $isRemote -}} {{- if $startsWithSlash -}} {{/* Images under static directory */}} - {{- $dest = (relURL $dest) -}} + {{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}} {{- else if and $isPage (not $startsWithRelative) -}} {{/* Images that are sibling to the individual page file */}} {{ $dest = (printf "../%s" $dest) }} diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html index 562ec3f9..fae0f71e 100644 --- a/layouts/shortcodes/card.html +++ b/layouts/shortcodes/card.html @@ -31,7 +31,9 @@ {{- $image = $processed.RelPermalink -}} {{- else -}} {{/* Otherwise, use relative link of the image */}} - {{- $image = ($image | relURL) -}} + {{- if hasPrefix $image "/" -}} + {{- $image = relURL (strings.TrimPrefix "/" $image) -}} + {{- end -}} {{- end -}} {{- end -}}