small fixes

This commit is contained in:
teldra 2022-06-22 16:45:15 +02:00
parent 1b42ef0135
commit b65a3b9e21
3 changed files with 2 additions and 182 deletions

View File

@ -1,12 +1,12 @@
{{ define "content" }}
<div>
{{ if eq .Kind "taxonomy" }}
<div>
{{ range .Pages }}
<a href="{{ .Page.Permalink }}" class="underline" style="margin-right: 1rem;">{{ .Page.Title }}</a>
{{ end }}
</div>
{{ else }}
{{- $pages := .Data.Pages -}}
{{ partial "snippets/gen_list" (dict "context" . "pages" $pages "content" .Content "type" .Type "paginate" true) }}
{{ end }}
</div>
{{ end }}

View File

@ -1,33 +0,0 @@
{{ define "intro" }}
{{ if ne .Content "" }}
{{ partial "snippets/content" (dict "content" .Content) }}
{{ end }}
{{ end }}
{{ define "content" }}
{{- $paginator := "" -}}
{{- $partial := "snippets/gen_list" -}}
{{- $paginate := true -}}
{{- $pages := .Data.Pages -}}
{{ $partial = string (printf "news/%s" $partial) }}
{{ partial $partial (dict "context" . "pages" $pages "content" .Content "type" .Type "paginate" $paginate) }}
{{ end }}
{{ define "sidebar" }}
{{ if gt .Site.Taxonomies.categories 0 }}
<aside class="sidebar">
<h3 class="align_menu">{{ if i18n "categories" }}{{ i18n "categories" }}{{ else }}{{ "Categories" }}{{ end }}</h3>
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies.categories }}
{{ $orig := $taxonomyname }}
{{ if ne (i18n $taxonomyname) "" }}
{{ $taxonomyname = i18n $taxonomyname }}
{{ else }}
{{ $taxonomyname = $taxonomyname | humanize }}
{{ end }}
<div class="align_menu"><a href="{{ "categories/" | relLangURL}}{{ $orig | urlize }}">{{ $taxonomyname }}</a></div>
{{ end }}
</aside>
{{ end }}
{{ end }}

View File

@ -1,147 +0,0 @@
{{ 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 }}