Resize images displayed in article-link.html

Currently the images are displayed at their full resolution. Those images could be very large, but end up being displayed as 300px wide. This changes that by resizing those images to a more suitable size.
This commit is contained in:
Chris Banes 2022-10-15 14:12:31 +01:00 committed by GitHub
parent eea1e72d81
commit e9a17fa52d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,9 +30,9 @@
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
{{ with .Resize "600x" }}
<div class="{{ $articleImageClasses }}" style="background-image:url({{ $featured.Permalink }});"></div> <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{- else -}} {{- else -}}
{{- with $.Site.Params.images }} {{- with $.Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}}
@ -76,4 +76,4 @@
</div> </div>
{{ end }} {{ end }}
</div> </div>
</a> </a>