Separate header_image to it's own partial

This commit is contained in:
ItsDrike 2021-08-27 00:06:10 +02:00
parent fb21e83c33
commit cc78f9d92c
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD
3 changed files with 10 additions and 11 deletions

View file

@ -1,6 +1,7 @@
{{ define "main" }}
<div id="main">
<div class="container">
{{ partial "header_image.html" . }}
{{ partial "content.html" . }}
</div>
</div>

View file

@ -1,14 +1,3 @@
{{ if .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>
{{ if .Params.subtitle }}
<h5 class="my-3">{{ markdownify .Params.subtitle | emojify }}</h5>

View file

@ -0,0 +1,9 @@
{{ if .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 }}