small fixes

This commit is contained in:
teldra 2022-04-06 21:20:16 +02:00
parent 18ad44e5e2
commit 9fdd7448e9
2 changed files with 17 additions and 11 deletions

View File

@ -118,7 +118,7 @@ article {
} }
#articletext img { #articletext img {
margin: 1.5rem 1.5rem 3rem 2rem;
border-radius: 15px; border-radius: 15px;
width: 80%; width: 80%;
} }

View File

@ -1,13 +1,17 @@
{{- if strings.HasPrefix .Destination "http" -}} {{- if strings.HasPrefix .Destination "http" -}}
<img loading="lazy" <a href="{{- .Destination -}}">
src="{{ .Destination | safeURL }}" <img loading="lazy"
alt="{{ .Text }}" src="{{ .Destination | safeURL }}"
{{ with .Title}} title="{{ . }}"{{ end }} /> alt="{{ .Text }}"
{{ with .Title}} title="{{ . }}"{{ end }} />
<div style="display: flex; justify-content: center;">{{ .Text }}</div>
</a>
{{- else -}} {{- else -}}
{{ if .Page.Resources.ByType "image" }} {{ if .Page.Resources.ByType "image" }}
{{ $nr := .Destination }} {{ $nr := .Destination }}
{{- $pic := index (.Page.Resources.ByType "image") (int $nr) -}} {{- $pic := index (.Page.Resources.ByType "image") (int $nr) -}}
{{- $image := .Page.Resources.GetMatch (printf "%s" ($pic | safeURL)) -}} {{- $image := .Page.Resources.GetMatch (printf "%s" ($pic | safeURL)) -}}
<div>
<a href="{{- $image.Permalink -}}"> <a href="{{- $image.Permalink -}}">
{{- $permalink := "" -}} {{- $permalink := "" -}}
@ -18,12 +22,14 @@
{{- $permalink = (printf "/%s" (.Destination | safeURL)) -}} {{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
{{- end -}} {{- end -}}
<img loading="lazy" <div style="display: flex; justify-content: center;"><img loading="lazy"
src="{{ $permalink }}" src="{{ $permalink }}"
alt="{{ .Text }}" alt="{{ .Text }}"
{{ with .Title}} title="{{ . }}"{{ end }} {{ with .Title}} title="{{ . }}"{{ end }}
width={{ $image.Width }} width={{ $image.Width }}
height="{{ $image.Height }}" /> height="{{ $image.Height }}" /></div>
<div style="display: flex; justify-content: center;">{{ .Text }}</div>
</a> </a>
</div>
{{ end }} {{ end }}
{{- end -}} {{- end -}}