small fixes

This commit is contained in:
teldra 2022-06-24 19:33:57 +02:00
parent 98072b6463
commit a8c779f778
4 changed files with 10 additions and 151 deletions

View File

@ -45,6 +45,8 @@ featured_expire = "8"
items_per_list = 5
pictureQuality = 50
# data for your imprint and contact page
[imprintdata]
tel = "(+) 49 5141 907 927"

View File

@ -1,143 +0,0 @@
{{ define "debug" }}
{{ .Section }}<br>
{{ end }}OLD
{{ $title := .Title }}
{{ $title = singularize $title }}
{{ $title = i18n $title }}
{{ if not $title }}
{{ $title = .Title }}
{{ end }}
{{ $good_w := "1920"}}
{{ $good_h := "850"}}
{{ $what := "none" }}
{{ $img := "" }}
{{ if eq .Kind "home" }}
{{ $what = "home" }}
{{ else if eq .Kind "term" }}
{{ $what = printf "term/%s" (anchorize .Title) }}
{{ else if eq .Kind "taxonomy" }}
{{ $what = .Data.Singular }}
{{ else }}
{{ with .File }}
{{ $what = .File.ContentBaseName }}
{{ end }}
{{ end }}
{{ $title_class := safeCSS "title" }}
{{ $css := safeCSS "b" }}
{{ if .IsHome }}
{{ $css = safeCSS "b_index" }}
{{ $title_class = safeCSS "title_index" }}
{{ end }}
{{ $banner := string (printf "/images/banner/%s*" $what) }}
{{ if resources.GetMatch $banner }}
{{ $img = resources.GetMatch $banner }}
{{ end }}
{{ $single := false }}
{{ if and (in .File "news/") (not (in .File "_index"))}}
{{ $single = true }}
{{ end }}
{{ $b := true }}
{{ $slug := "" }}
{{ with .File }}
{{ $slug = anchorize .ContentBaseName }}
{{ end }}
{{ if and $img (ne .Params.banner false) }}
{{ if .Resources.Match "banner*" }}
{{ $img = .Resources.GetMatch "banner*" }}
{{ end }}
{{ if .Resources.ByType "image" }}
{{ $img = index (.Resources.ByType "image") 0 }}
{{ end }}
{{ if $img }}
{{ $tiny := ($img.Resize "640x q90") }}
{{ $small := ($img.Resize "768x q90") }}
{{ $medium := ($img.Resize "10240x q90") }}
{{ $large := ($img.Resize "1366x q90") }}
<style>
@media (min-width: 40em) {
.ttestt {
background-image: url({{- $tiny.Permalink -}});
}
}
@media (min-width: 48em) {
.ttestt {
background-image: url({{- $small.Permalink -}});
}
}
@media (min-width: 64em) {
.ttestt {
background-image: url({{- $medium.Permalink -}});
}
}
@media (min-width: 85.375em) {
.ttestt {
background-image: url({{- $large.Permalink -}});
}
}
@media (min-width: 120em) {
.ttestt {
background-image: url({{- $img.Permalink -}});
}
}
</style>
<div class="ttestt banner {{ $css }}" style="background-image: url({{- $img.Permalink -}});">
{{ if eq hugo.Environment "development" }}
<div class="dev right">
{{ $w := $img.Width }}
{{ $h := $img.Height }}
{{ if lt (int $w) $good_w }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Width: {{ $w }}px: too small, better {{ $good_w -}}px in width<br>
{{ end }}
{{ else if gt (int $w) $good_w }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Width: {{ $w }}px: too big, better {{ $good_w -}}px in width<br>
{{ end }}
{{ end }}
{{ if lt (int $h) $good_h }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Height: {{ $h }}px: too small, better {{ $good_h -}}px in height<br>
{{ end }}
{{ else if gt (int $h) $good_h }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Height: {{ $h }}px: too big, better {{ $good_h -}}px in height<br>
{{ end }}
{{ end }}
{{ if eq hugo.Environment "development" }}
{{ if eq $b false }}
{{ printf "Please correct content/news/%s/%s" $slug $img.Name }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
</div>
{{ end }}
{{ else }}
<div class="banner b altbg">
{{ if eq hugo.Environment "development" }}
{{ if eq .Params.banner false }}
<div class="dev right black">
Info: Banner is turned off for this.
{{ else }}
<div class="dev right">
{{ if eq $single true }}
{{ with .File }}
{{ printf "content/%sbanner* missing.." .Dir }}
{{ end }}
{{ else if eq $single false }}
{{ printf "assets/images/banner/%s* missing.." $what }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
</div>
{{ end }}
OLD

View File

@ -12,10 +12,10 @@
{{ $test := true }}
{{ if and $img (ne $banner false) }}
{{ $tiny := ($img.Resize "640x q90") }}
{{ $small := ($img.Resize "768x q90") }}
{{ $medium := ($img.Resize "10240x q90") }}
{{ $large := ($img.Resize "1366x q90") }}
{{ $tiny := ($img.Resize "640x q50") }}
{{ $small := ($img.Resize "768x q50") }}
{{ $medium := ($img.Resize "10240x q50") }}
{{ $large := ($img.Resize "1366x q50") }}
<div class="ttestt banner b" style="background-image: url({{- $img.Permalink -}});">
{{ if eq hugo.Environment "development" }}
<div class="dev right">

View File

@ -115,10 +115,10 @@
{{ end }}
{{ if eq $b true }}
{{ $tiny := ($banner.Resize "640x q90") }}
{{ $small := ($banner.Resize "768x q90") }}
{{ $medium := ($banner.Resize "1024x q90") }}
{{ $large := ($banner.Resize "1366x q90") }}
{{ $tiny := ($banner.Resize "640x q50") }}
{{ $small := ($banner.Resize "768x q50") }}
{{ $medium := ($banner.Resize "1024x q50") }}
{{ $large := ($banner.Resize "1366x q50") }}
<img loading="lazy" srcset="{{- with $tiny.RelPermalink -}}{{.}} 640w{{- end -}}
{{- with $small.RelPermalink -}}, {{.}} 768w{{- end -}}
{{- with $medium.RelPermalink -}}, {{.}} 1024w{{- end -}}