From 22a15f69d58d2a1f20b821c379e351a3ccf1551a Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 26 Sep 2022 11:06:31 -0400 Subject: [PATCH] Use custom image render hook to properly size images --- .../layouts/_default/_markup/render-image.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 themes/red/layouts/_default/_markup/render-image.html diff --git a/themes/red/layouts/_default/_markup/render-image.html b/themes/red/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..22f0fa3 --- /dev/null +++ b/themes/red/layouts/_default/_markup/render-image.html @@ -0,0 +1,17 @@ +{{- $url := .Destination | safeURL -}} +{{- $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 }} + +
{{ $.Text }}
+
+ +{{- end -}}