From 228cf0d83f6972d57c735dac273635a7f022aeac Mon Sep 17 00:00:00 2001 From: Reorx Date: Fri, 20 May 2022 18:19:35 +0800 Subject: [PATCH] use RelPermalink for markdown images --- layouts/_default/_markup/render-image.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 1acb87d..9c3c9a7 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1,9 @@ -{{ .Text }} +{{- $img := .Page.Resources.GetMatch .Destination -}} +{{- if and (not $img) .Page.File -}} + {{ $path := path.Join .Page.File.Dir .Destination }} + {{- $img = resources.Get $path -}} +{{- end -}} + +{{- with $img -}} + {{ $.Text }} +{{- end -}}