Automatically add the featured media to individual posts

This commit is contained in:
2021-10-19 14:01:35 -05:00
parent 937a80bc17
commit 96067c95c0
3 changed files with 23 additions and 18 deletions

View File

@ -0,0 +1,18 @@
<div class="post-media">
<figure>
{{ $media := . | resources.Fingerprint "sha512" }}
{{ if eq .MediaType.MainType "image" }}
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
{{ else if eq .MediaType.MainType "video" }}
<video controls>
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">
</video>
{{ end }}
{{ with $media.Title }}
<figcaption>
{{ . | markdownify }}
</figcaption>
{{ end }}
</figure>
</div>