Add featured image to news articles

This commit is contained in:
Bjørn Erik Pedersen 2018-01-31 15:44:19 +01:00
parent bba1104b86
commit 34f2a41f2a
No known key found for this signature in database
GPG Key ID: 330E6E2BD4859D8F
2 changed files with 7 additions and 2 deletions

View File

@ -47,8 +47,13 @@
<div class="fn pl5-l pt3 mid-gray w-100 w-two-third-l sans-serif nested-copy-line-height no-underline nested-links nested-img nested-copy-seperator nested-blockquote measure-wide-l"><!-- TODO: Can the content top and the description top line up more precisely, or is just winging it with padding the best we've got? -->
{{ with .Params.featured_image_path }}
<img src="{{ . }}" alt="Featured Image for {{ $.Title }}" class="mw-100">
{{ end }}
{{ else }}
{{ $featured := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ with $featured }}
{{ $featured := .Resize "480x" }}
<img src="{{ $featured.RelPermalink }}" alt="Featured Image for {{ $.Title }}" class="mw-100">
{{ end }}
{{ end }}
{{ .Content }}
</div>
</div>