Set html size attributes for images

This commit is contained in:
2020-12-03 17:55:35 +01:00
parent f307dfe308
commit 52216c8af2
4 changed files with 25 additions and 17 deletions
+6 -3
View File
@@ -37,11 +37,14 @@
{{ if .Params.Cover }}
<figure class="post-cover">
{{ $img := imageConfig (printf "static/%s" .Params.Cover) }}
{{ if .Params.UseRelativeCover }}
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}"
alt="{{ .Title | plainify | default " " }}" />
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}"
width="{{ $img.Width }}" height="{{ $img.Height }}" />
{{ else }}
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}" />
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}"
width="{{ $img.Width }}" height="{{ $img.Height }}" />
{{ end }}
{{ if .Params.CoverCaption }}