From 2ba7dae3c080c5fac21f4d7f1663c8f524fefb26 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 1 Apr 2024 21:48:31 +0300 Subject: Add a render image hook (#39768) Images are now lazyloaded, they have width and height attributes and the classes are centralized. Only applies to Markdown images --- site/layouts/_default/_markup/render-image.html | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 site/layouts/_default/_markup/render-image.html (limited to 'site/layouts/_default/_markup') diff --git a/site/layouts/_default/_markup/render-image.html b/site/layouts/_default/_markup/render-image.html new file mode 100644 index 000000000..fd089f7be --- /dev/null +++ b/site/layouts/_default/_markup/render-image.html @@ -0,0 +1,8 @@ +{{- $originalSrc := .Destination | safeURL -}} +{{- $localImgPath := path.Join "/site/static/docs" site.Params.docs_version $originalSrc -}} +{{- /* This shouldn't be needed but we have a weird folder structure with version included... */ -}} +{{- $src := urls.JoinPath "/docs" site.Params.docs_version $originalSrc -}} +{{- $config := imageConfig $localImgPath -}} +{{- $classes := "d-block img-fluid" -}} + +{{ .Text }} -- cgit v1.2.3