bunteshaus.de/themes/buha/layouts/partials/layout/article.html
2022-06-15 17:15:05 +02:00

71 lines
2.4 KiB
HTML

{{ $metas := dict "when" .context.Params.when "price" .context.Params.price "contact_mail" .context.Params.contact_mail "covid" .context.Params.covid "insta" .context.Params.insta }}
{{ $banner := slice }}
{{ $image := slice }}
{{ $thumb := "" }}
{{ if .context.Resources.GetMatch "banner*" }}
{{ $banner = slice (.context.Resources.GetMatch "banner*") }}
{{ end }}
{{ if .context.Resources.ByType "image" }}
{{ $image = .context.Resources.ByType "image" }}
{{ end }}
{{ $image = (index (complement $banner $image) 0) }}
{{ if $banner }}
{{ $image = (index $banner 0) }}
{{ end }}
{{ $image = .context.Resources.GetMatch (string $image) }}
{{ if ne $image nil }}
{{ $thumb1 := $image.Fill "1280x480 smart"}}
{{ $thumb = $image}}
{{ end }}
{{ partial "snippets/article_metadata" $metas }}
{{- if .context.Description -}}
<p>{{ .context.Description }}</p>
{{ end }}
{{ $count_href := .context.TableOfContents | strings.Count "href" }}
{{ if ge $count_href 4 }}
<details open>
<summary class="toc-head">Inhaltsverzeichnis</summary>
<div class="toc">
{{ .context.TableOfContents }}
</div>
</details>
{{ end }}
{{ $content := .context.Content }}
{{ if or .context.Content (.context.Resources.ByType "image")}}
<div class="article_content">
{{- if .context.Content -}}
{{- $content -}}
{{ end }}
{{ if .context.Resources.ByType "image" }}
{{ range .context.Resources.ByType "image" }}
{{ $picname := . }}
{{ if not (or (in $content $picname ) (hasPrefix $picname "banner") )}}
<div class="article-image">
<a href="{{- $image.Permalink -}}" class="no_underline">
<img loading="lazy"
src="{{ .Permalink }}"
alt="{{ . }}"
{{ with .Title}} title="{{ . }}"{{ end }}
width={{ $image.Width }}
height="{{ $image.Height }}" />
</a>
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ if and (.comtext.Resources.GetMatch $banner) (ne .context.Params.banner false) }}
{{ else if and (.context.Resources.Match "banner*") (ne .context.Params.banner false) }}
{{ else if and (.context.Resources.ByType "image") (ne .context.Params.banner false) }}
{{ else }}
{{ end }}