bunteshaus.de/themes/buha/layouts/posts/single.html

148 lines
5.7 KiB
HTML
Raw Normal View History

2022-06-22 16:09:01 +02:00
{{ define "content" }}
<article>
{{ $metas := dict "when" .Params.when "price" .Params.price "contact_mail" .Params.contact_mail "covid" .Params.covid "insta" .Params.insta }}
{{ $banner := slice }}
{{ $image := slice }}
{{ $thumb := "" }}
{{ if .Resources.GetMatch "banner*" }}
{{ $banner = slice (.Resources.GetMatch "banner*") }}
{{ end }}
{{ if .Resources.ByType "image" }}
{{ $image = .Resources.ByType "image" }}
{{ end }}
{{ $image = (index (complement $banner $image) 0) }}
{{ if $banner }}
{{ $image = (index $banner 0) }}
{{ end }}
{{ $image = .Resources.GetMatch (string $image) }}
{{ if ne $image nil }}
{{ $thumb1 := $image.Fill "1280x480 smart"}}
{{ $thumb = $image}}
{{ end }}
{{ partial "snippets/article_metadata" $metas }}
{{- if .Description -}}
<p>{{ .Description }}</p>
{{ end }}
{{ $count_href := .TableOfContents | strings.Count "href" }}
{{ if ge $count_href 4 }}
<details open>
<summary class="toc-head">Inhaltsverzeichnis</summary>
<div class="toc">
{{ .TableOfContents }}
</div>
</details>
{{ end }}
{{ $content := .Content }}
{{ if or .Content (.Resources.ByType "image")}}
<div class="article_content">
{{- if .Content -}}
{{- $content -}}
{{ end }}
{{ if .Resources.ByType "image" }}
{{ range .Resources.ByType "image" }}
{{ $picname := . }}
{{ if not (or (in $content $picname ) (hasPrefix $picname "banner") )}}
<a href="{{- $picname.Permalink -}}" class="article_image no_underline">
<img loading="lazy"
src="{{ .Permalink }}"
alt="{{ . }}"
{{ with .Title}} title="{{ . }}"{{ end }}
width={{ $picname.Width }}
height="{{ $picname.Height }}" /><br>
</a>
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
</article>
{{ end }}
{{ define "sidebar" }}
{{ if ne .Type "tools" }}
<aside class="sidebar">
{{ if or .Params.categories .Params.events }}
<h3 class="align_menu">{{ if i18n "categories" }}{{ i18n "categories" }}{{ else }}{{ "Categories" }}{{ end }}</h3>
{{ end }}
{{ if .Params.categories }}
{{ range .Params.categories }}
<div class="align_menu"><a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></div>
{{ end }}
{{ end }}
{{ if .Params.events }}
{{ range .Params.events }}
<div class="align_menu"><a href="{{ "/events/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></div>
{{ end }}
{{ end }}
{{ if .Params.tags }}
<h3 class="align_menu"><a href="{{ "/tags/" | relLangURL }}">{{ if i18n "tags" }}{{ i18n "tags" }}{{ else }}{{ "Tags" }}{{ end }}</a></h3>
{{ range .Params.tags }}
<div class="align_menu"><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></div>
{{ end }}
{{ end }}
{{ $related := .Site.RegularPages.RelatedIndices . "tags" | first 5 }}
{{ if $related }}
<h3 class="align_menu">Related</h3>
{{ range $related }}
<div class="align_menu"><a href="{{ .Permalink }}">{{ .Title }}</a></div>
{{ end }}
{{ end }}
</aside>
{{ end }}
{{ end }}
{{ define "inner_footer" }}
{{ if and (eq .Kind "page") (or (eq .Section "news") (eq .Section "events") (eq .Section "about")) }}
<div class="article_footer">
{{ with .Params.foundations }}
<div class="bold">Träger der Veranstaltung:</div>
<div class="foundations_items">
{{ range . }}
{{ $l := . }}
{{ $url := "" }}
{{ if isset site.Params.foundations $l }}
{{ $url = index site.Params.foundations $l }}
{{ end }}
{{- $res_im := resources.GetMatch (printf "/images/foundations/%s*" $l ) -}}
{{ if $res_im }}
<div class="foundations_item">
{{ if $url }}<a href="{{ $url | safeHTML }}">{{ end }}<img src="{{- $res_im.Permalink -}}" class="borderrad4px article_footer_item1" /> {{ if $url }}</a>{{ end }}
</div>
{{ else }}
{{ if eq hugo.Environment "development" }}
<div class="foundations_item">
assets/images/foundations/{{- $l -}} .* missing
</div>
{{ else }}
picture missing.
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
<div class="mod_times">
<div class="mod_times_item">
<div class="bold">{{ if i18n "created" }}{{ i18n "created" }}{{ else }}{{ "Created" }}{{ end }}: </div>
<div>{{ .Date | time.Format ":date_full" }}</div>
</div>
{{ if ne .Date .Lastmod }}
<div class="mod_times_item">
<div class="bold">{{ if i18n "lastmod" }}{{ i18n "lastmod" }}{{ else }}{{ "Last modification" }}{{ end }}: </div>
<div>{{ .Lastmod | time.Format ":date_full" }}</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}