small fixes

This commit is contained in:
teldra 2022-06-12 23:48:26 +02:00
parent a9d545097f
commit 5b5c0d034c
4 changed files with 25 additions and 18 deletions

View File

@ -10,17 +10,11 @@
h3 {
margin-top: 0rem;
}
.img {
background-position: top center;
background-repeat: no-repeat;
position: relative;
background-size: cover;
height: calc(33vh / 2.4);
.text > img {
width: 64%;
}
.img-only {
width: 100%;
height: 20vh;
transition: all .2s ease-in-out;
height: 40vh;
background-size: 100% auto;
background-position: top;
background-repeat: no-repeat;

View File

@ -22,7 +22,23 @@
{{- if .context.Content -}}
<div class="article_content">{{- .context.Content -}}</div>
{{ else if .context.Resources.ByType "image" }}
{{ range .context.Resources.ByType "image" }}
<a href="{{- $image.Permalink -}}" class="no_underline">
<img loading="lazy"
src="{{ .Permalink }}"
alt="{{ . }}"
{{ with .Title}} title="{{ . }}"{{ end }}
width={{ $image.Width }}
height="{{ $image.Height }}" />
<div>{{ . }}</div>
</a>
{{ end }}
{{ end }}
{{ 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 }}

View File

@ -80,8 +80,7 @@
<p>{{ .Content }}</p>
{{ else if $image }}
{{ $i := (.Resources.GetMatch $image).Permalink }}
<div class="img-only" style="background-image: url({{ $i }})">
</div>
<img src="{{ $i }}" />
{{ end }}
</div>
</section>

View File

@ -6,8 +6,6 @@
{{ end }}
{{ $good_w := "1920"}}
{{ $good_h := "550"}}
{{ $px := string "400" }}
{{ $fill := string (printf "1280x%s smart" $px) }}
{{ $what := "none" }}
{{ $img := "none" }}
{{ if eq .Kind "home" }}
@ -23,7 +21,7 @@
{{ end }}
{{ $banner := printf "/images/banner/%s*" $what }}
{{ if resources.GetMatch $banner }}
{{ $img = (resources.GetMatch $banner).Fill $fill }}
{{ $img = resources.GetMatch $banner }}
{{ end }}
{{ if and (resources.GetMatch $banner) (ne .Params.banner false) }}
<div style="background-image: url({{- $img.Permalink -}})" class="banner">
@ -54,7 +52,7 @@
{{ end }}
</div>
{{ else if and (.Resources.Match "banner*") (ne .Params.banner false) }}
{{ $img = (.Resources.GetMatch "banner*").Fill $fill }}
{{ $img = .Resources.GetMatch "banner*" }}
<div style="background-image:url({{- $img.Permalink -}})" class="banner">
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
{{ if eq hugo.Environment "development" }}
@ -82,8 +80,8 @@
</div>
{{ end }}
</div>
{{ else if and (.Resources.ByType "image") (ne .Params.banner false) }}
{{ $img = (index (.Resources.ByType "image") 0).Fill $fill }}
{{ else if and (.Resources.ByType "image") (ne .Params.banner false) (not true) }}
{{ $img = index (.Resources.ByType "image") 0 }}
<div style="background-image: url({{- $img.Permalink -}})" class="banner">
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
{{ if eq hugo.Environment "development" }}