Add width and height to image to prevent layout shifts

alternate-navbar
Maik de Kruif 4 years ago
parent 4c0b098e53
commit 821e97627d
Signed by: maik
GPG Key ID: 44A55AD1F0673FA6
  1. 3
      themes/maik-blog/layouts/index.html

@ -2,8 +2,9 @@
<main role="main" style=""> <main role="main" style="">
<div> <div>
{{- if .Site.Params.Portrait.Path }} {{- if .Site.Params.Portrait.Path }}
{{- $img := imageConfig (printf "static/%s" .Site.Params.Portrait.Path) }}
<img src="{{ .Site.Params.Portrait.Path }}" class="circle" alt="{{ .Site.Params.Portrait.Alt }}" <img src="{{ .Site.Params.Portrait.Path }}" class="circle" alt="{{ .Site.Params.Portrait.Alt }}"
style="max-width:{{ .Site.Params.Portrait.Size }}" /> width="{{ $img.Width }}" height="{{ $img.Height }}" style="max-width:{{ .Site.Params.Portrait.Size }}" />
{{- end }} {{- end }}
<h1>{{ .Site.Title }}</h1> <h1>{{ .Site.Title }}</h1>

Loading…
Cancel
Save