diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-01-06 22:05:55 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-01-06 22:05:55 +0100 |
commit | 2e913997fbacd664a3ba73875e002227ba3b78c8 (patch) | |
tree | 5bf855ed22df707a1f62ae6911d8fc7a4de48751 /layouts/partials/leading_image.html | |
parent | bd178fb2478a79537247332f3409cb5cc35ae544 (diff) | |
download | hugo-minimalist-theme-2e913997fbacd664a3ba73875e002227ba3b78c8.tar.gz hugo-minimalist-theme-2e913997fbacd664a3ba73875e002227ba3b78c8.tar.bz2 hugo-minimalist-theme-2e913997fbacd664a3ba73875e002227ba3b78c8.zip |
leading image include width & height
Diffstat (limited to 'layouts/partials/leading_image.html')
-rw-r--r-- | layouts/partials/leading_image.html | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/layouts/partials/leading_image.html b/layouts/partials/leading_image.html index 2f8e491..1b5cf28 100644 --- a/layouts/partials/leading_image.html +++ b/layouts/partials/leading_image.html @@ -8,12 +8,13 @@ <div class="text-center"> <div class="relative inline-block"> <img - src="{{ if ne .MediaType.SubType "svg" }} - {{ $image := .Fit (default "768x400" $.Params.image_size) }} - {{ $image.RelPermalink }} + {{ if ne .MediaType.SubType "svg" }} + {{ $image := .Fit (default "768x400 webp" $.Params.image_size) }} + width="{{ $image.Width }}" height="{{ $image.Height }}" + src="{{ $image.RelPermalink }}" {{ else }} - {{ $image.RelPermalink }} - {{ end }}" + src="{{ $image.RelPermalink }}" + {{ end }} class="m-0" alt="{{ .Title }}" /> |