Skip to content

Commit

Permalink
fix: add width and height to header/featured image (#2463)
Browse files Browse the repository at this point in the history
Prevent layout shift (Lighthouse)
  • Loading branch information
jtatum committed Sep 12, 2021
1 parent 509c887 commit 0c28715
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wowchemy/layouts/partials/page_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{{- end -}}
{{- end -}}
{{ if $img }}
<img src="{{$img.RelPermalink}}" class="article-banner" alt="{{$alt}}">
<img src="{{$img.RelPermalink}}" width="{{$img.Width}}" height="{{$img.Height}}" class="article-banner" alt="{{$alt}}">
{{ else }}
<img src="{{ .Params.header.image }}" class="article-banner" alt="{{$alt}}">
{{ end }}
Expand Down Expand Up @@ -75,7 +75,7 @@ <h1>{{ $title }}</h1>
{{/* Featured image */}}
<div class="article-header {{$image_container}} featured-image-wrapper mt-4 mb-4" style="max-width: {{$image.Width}}px; max-height: {{$image.Height}}px;">
<div style="position: relative">
<img src="{{ $image.RelPermalink }}" alt="{{ with $.Params.image.alt_text }}{{.}}{{ end }}" class="featured-image">
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ with $.Params.image.alt_text }}{{.}}{{ end }}" class="featured-image">
{{ with $.Params.image.caption }}<span class="article-header-caption">{{ . | markdownify | emojify }}</span>{{ end }}
</div>
</div>
Expand Down

0 comments on commit 0c28715

Please sign in to comment.