bunteshaus.de/themes/buha/layouts/partials/layout/article.html

71 lines
2.4 KiB
HTML
Raw Normal View History

2022-04-28 14:53:58 +02:00
{{ $metas := dict "when" .context.Params.when "price" .context.Params.price "contact_mail" .context.Params.contact_mail "covid" .context.Params.covid "insta" .context.Params.insta }}
2022-05-09 21:37:34 +02:00
{{ $banner := slice }}
{{ $image := slice }}
{{ $thumb := "" }}
{{ if .context.Resources.GetMatch "banner*" }}
{{ $banner = slice (.context.Resources.GetMatch "banner*") }}
2022-04-09 21:34:04 +02:00
{{ end }}
2022-05-09 21:37:34 +02:00
{{ 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}}
2022-04-09 21:34:04 +02:00
{{ end }}
2022-05-06 14:39:53 +02:00
2022-06-15 01:49:15 +02:00
2022-05-09 21:37:34 +02:00
{{ partial "snippets/article_metadata" $metas }}
2022-05-06 14:39:53 +02:00
2022-06-12 23:55:39 +02:00
{{- if .context.Description -}}
<p>{{ .context.Description }}</p>
{{ end }}
2022-06-15 01:49:15 +02:00
{{ $count_href := .context.TableOfContents | strings.Count "href" }}
{{ if ge $count_href 4 }}
2022-06-15 03:11:21 +02:00
<details open>
<summary class="toc-head">Inhaltsverzeichnis</summary>
2022-06-15 01:49:15 +02:00
<div class="toc">
{{ .context.TableOfContents }}
</div>
2022-06-15 03:11:21 +02:00
</details>
2022-06-15 01:49:15 +02:00
{{ end }}
2022-06-15 12:59:10 +02:00
{{ $content := .context.Content }}
2022-06-15 01:49:15 +02:00
2022-06-15 12:59:10 +02:00
{{ if or .context.Content (.context.Resources.ByType "image")}}
2022-06-15 01:49:15 +02:00
<div class="article_content">
2022-06-15 12:59:10 +02:00
{{- if .context.Content -}}
2022-06-15 01:49:15 +02:00
{{- $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>
2022-04-10 02:24:33 +02:00
{{ end }}
2022-06-12 23:48:26 +02:00
{{ 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 }}