Support local resource images in content

This commit is contained in:
ItsDrike 2021-08-27 00:01:44 +02:00
parent fa18460df0
commit fb21e83c33
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

View file

@ -1,6 +1,12 @@
{{ if .Params.image }}
<img class="mb-3 header-image" src='{{ .Params.image }}' />
{{ .Scratch.Set "image" .Params.image }}
{{ if hasPrefix .Params.image "resource:" }}
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
{{ .Scratch.Set "image" ($resource.Resize "2000x").RelPermalink }}
{{ end }}
<img class="mb-3 header-image" src='{{ .Scratch.Get "image" }}' />
{{ end }}
<h1 class="display-4">{{ .Title }}</h1>