mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-28 23:59:53 +02:00
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
This commit is contained in:
8
site/layouts/_default/_markup/render-image.html
Normal file
8
site/layouts/_default/_markup/render-image.html
Normal file
@@ -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" -}}
|
||||
|
||||
<img src="{{ $src }}" class="{{ $classes }}" alt="{{ .Text }}" width="{{ $config.Width }}" height="{{ $config.Height }}" loading="lazy">
|
Reference in New Issue
Block a user