Cleanup image resource processing templating
God go templates suck
This commit is contained in:
parent
d40c73169d
commit
5352e9770c
2 changed files with 6 additions and 6 deletions
|
@ -1,12 +1,15 @@
|
|||
{{ if .Params.image }}{{ if not .Params.hide_header_image }}
|
||||
{{ if and .Params.image (not .Params.hide_header_image) }}
|
||||
{{ .Scratch.Set "image" .Params.image }}
|
||||
{{ if hasPrefix .Params.image "resource:" }}
|
||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||
{{ .Scratch.Set "image" ($resource.Resize "1000x").RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
<div class="mb-3 image header-image" data-image='{{ .Scratch.Get "image" }}'></div>
|
||||
{{ end }}{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "breadcrumbs/index.html" . }}
|
||||
|
||||
<h1 class="display-4">{{ .Title }}</h1>
|
||||
{{ if .Params.subtitle }}
|
||||
<h5 class="my-3">{{ markdownify .Params.subtitle | emojify }}</h5>
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
{{ if .Params.image }}
|
||||
{{ .Scratch.Set "image" .Params.image }}
|
||||
{{ if hasPrefix .Params.image "resource:" }}
|
||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||
{{ .Scratch.Set "image" ($resource.Fill "800x418").Permalink }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "image" .Params.image}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $image := .Scratch.Get "image" }}
|
||||
|
||||
|
||||
{{/* Twitter-specific tags */}}
|
||||
<meta name="twitter:dnt" content="on" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
|
@ -23,7 +21,6 @@
|
|||
<meta name="twitter:image:alt" content="{{ .Title | htmlUnescape }}" />
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{/* OpenGraph tags*/}}
|
||||
<meta property="og:title" content="{{ .Title | htmlUnescape }}" />
|
||||
<meta property="og:type" content="{{ .Kind }}" />
|
||||
|
|
Loading…
Reference in a new issue