small fixes

This commit is contained in:
teldra 2022-06-15 18:17:00 +02:00
parent 1503626c02
commit aac92ebc8a
3 changed files with 46 additions and 3 deletions

View File

@ -62,6 +62,7 @@
color: red;
background: var(--background-alt);
display: flex;
font-size: smaller;
}
.black {

View File

@ -12,7 +12,6 @@
{{ end }}
{{ if $p }}
<div class="gen_list">
{{ if $title }}
@ -28,11 +27,16 @@
</h2>
{{ end }}
{{ range $p }}
{{ $slug := anchorize .File.ContentBaseName }}
<div class="list_item">
{{ $metas := dict "when" .Params.when "price" .Params.price }}
{{ $banner := slice }}
{{ $image := slice }}
{{ $images := slice }}
{{ $dir := ""}}
{{ with .File }}
{{ $dir = .Dir }}
{{ end }}
{{ if .Resources.GetMatch "banner*" }}
{{ $banner = slice (.Resources.GetMatch "banner*") }}
{{ end }}
@ -67,7 +71,7 @@
{{ $good_h := "550"}}
{{ $b := true }}
{{ if or (lt (int .Width) $good_w) (gt (int .Width) $good_w) (lt (int .Height) $good_h) (gt (int .Height) $good_h) }}
<div class="dev left" style="margin: 1rem;">
<div class="dev left">
{{ if lt (int .Width) $good_w }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
@ -90,13 +94,23 @@
Height: {{ .Height }}px: too big, must be {{ $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 .Name }}
{{ end }}
{{ end }}
</div>
{{ end }}
<!--<div class="img" style="background-image: url({{ .Permalink }})">
</div>-->
{{ if eq $b true }}
<img src="{{ .Permalink }}" alt="Banner Image." />
{{ end }}
{{ else }}
<div class="dev left">
{{ printf "content/%sbanner* missing.." $dir }}
</div>
{{ end }}
{{ partial "snippets/article_metadata" $metas }}
<div class="text">

View File

@ -33,7 +33,8 @@
{{ if and (in .File "news/") (not (in .File "_index"))}}
{{ $single = true }}
{{ end }}
{{ $b := true }}
{{ $slug := anchorize .File.ContentBaseName }}
{{ if and (ne $img "none") (ne .Params.banner false) }}
<div style="background-image: url({{- $img.Permalink -}})" class="banner {{ $css }}">
{{ if eq hugo.Environment "development" }}
@ -41,23 +42,32 @@
{{ $w := (resources.GetMatch $banner).Width }}
{{ $h := (resources.GetMatch $banner).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 }}
@ -70,23 +80,32 @@
{{ $w := (index (.Resources.Match "banner*") 0).Width }}
{{ $h := (index (.Resources.Match "banner*") 0).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 }}
@ -99,23 +118,32 @@
{{ $w := (index (.Resources.ByType "image") 0).Width }}
{{ $h := (index (.Resources.ByType "image") 0).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 }}