From ba7a968881083b9d3b3b6ecd65df076e76bcb164 Mon Sep 17 00:00:00 2001
From: Mattia Ippoliti <Ippolitimattia@gmail.com>
Date: Sat, 01 Apr 2023 20:50:08 +0000
Subject: [PATCH] fix: padding for empty title callouts (#308)
---
layouts/_default/_markup/render-image.html | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index ff4e8b3..dbcf732 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -1,8 +1,9 @@
{{$src := .Destination | safeURL }}
+{{$width := index (split .Text "|") 1 | default "auto" }}
{{$external := strings.HasPrefix $src "http" }}
{{- if $external -}}
-<img src="{{ $src }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
+<img src="{{ $src }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
{{- else -}}
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
-<img src="{{ $fixedUrl }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
+<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
{{- end -}}
--
Gitblit v1.10.0